//// EXAMPLE.H ////
template <class T> struct Example
{
Example <T>( );
};
////////////////
//// EXAMPLE.CPP ////
#include "Example.h"
template <class T> Example <T> :: Example <T> ( )
{
}
/* INTERESTING NOTE: This version of the code works fine
Example<int> :: Example<int> ( )
{
}
*/
/////////////////////
//// MAIN.CPP ////
#include "Example.h"
void main ( )
{
Example<int> E;
}
/////////////////////
Main.obj makes a linker error "unresolved external symbol: public: __thiscall Example<int>::Example<int>(void)". The error does not occur if the constructor definition is placed in MAIN.CPP or EXAMPLE.H, but when called from a different file from which it's defined in, it makes the linker error. Is there anyway to fix this, besides moving the location of the constructor?
~CGameProgrammer( );Edited by - CGameProgrammer on January 3, 2002 1:20:15 PM