#175253 - Polaris - Sat Oct 16, 2010 9:15 pm
I have read that you can choose among different methods to have your template class divided into a .h and .cpp. I didn't quite liked any, but i chose the one below.
The problem is that Visual Studio 2008 Express complains about it. Saying the following:
error C2995: 'Factory<BaseClassType>::Factory(void)' : function template has already been defined
I really can't figure out what the problem is, I found the solution posted in several different places, so I'm guessing it is me being blind to some small syntax error.
Code: |
#ifndef MYCLASS_H
#define MYCLASS_H template<class BaseClassType> class Factory { public: Factory(void); ~Factory(void); }; #include "Factory.cpp" #endif |
Code: |
#include "Factory.h"
template<class BaseClassType> Factory<BaseClassType>::Factory(void) { } template<class BaseClassType> Factory<BaseClassType>::~Factory(void) { } |
The problem is that Visual Studio 2008 Express complains about it. Saying the following:
error C2995: 'Factory<BaseClassType>::Factory(void)' : function template has already been defined
I really can't figure out what the problem is, I found the solution posted in several different places, so I'm guessing it is me being blind to some small syntax error.