Hi.
I made a class template for a scene, called
template< typename T >
class CScene
{
. . .
} ;
Then, in Main.h, I declared a pointer to
this class template, like this:
CScene< ISolarSystem > *pMilkyScene ;
Then in Main.cpp, I give memory to the pointer to
the class template:
pMilky = new CMilkyWay() ;
pMilkyScene = new CScene< ISolarSystem > ;
pMilky is a pointer of the type ISolarSystem and
CMilkyWay is a class derived from ISolarSystem.
Then, after the preceeding definitions, I assign
the pMilky to the class template pointer, like this:
pMilkyScene->Initialize( "Solar System" ) ;
pMilkyScene->AppendObject( pMilky ) ;
This seems not to work, because I get the following:
Quote:
1>Main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CScene<class ISolarSystem>::AppendObject(class ISolarSystem * &)" (?AppendObject@?$CScene@VISolarSystem@@@@QAE_NAAPAVISolarSystem@@@Z) referenced in function "void __cdecl SpecialKeys(int,int,int)" (?SpecialKeys@@YAXHHH@Z)
1>Main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CScene<class ISolarSystem>::Initialize(char *)" (?Initialize@?$CScene@VISolarSystem@@@@QAE_NPAD@Z) referenced in function "void __cdecl SpecialKeys(int,int,int)" (?SpecialKeys@@YAXHHH@Z)
1>Main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CScene<class ISolarSystem>::Release(void)" (?Release@?$CScene@VISolarSystem@@@@QAE_NXZ) referenced in function "public: __thiscall CScene<class ISolarSystem>::~CScene<class ISolarSystem>(void)" (??1?$CScene@VISolarSystem@@@@QAE@XZ)
1>D:\D_Programming\D_P_FH\Semester2\Cg\Pr01\Praktikum01\Debug\Praktikum01.exe : fatal error LNK1120: 3 unresolved externals
Those functions are defined within CScene.cpp like :
...
template< typename T >
bool CScene< T >::AppendObject( T* &rObj )
{
m_pSceneObjects->push_back( &rObj ) ;
return true ;
}
...
Has anybody any idea what could be wrong???
Grateful
Alex