i'm using vs2005, working on a c++ application. i'm trying to create a base template class and inherit from that, but the project returns an error when it compiles. for example, the base class would look like...
then, the class that inherits from this would look like...
everything compiles fine when i just have the base template class. also, if i have the "accessLevels" class with the constructor and destructor removed (just the shell), it compiles fine. as soon as i include the constructor, the build process fails with a linker error...
Error 1 error LNK2019: unresolved external symbol "public: __thiscall BaseTable<int>::BaseTable<int>(void)" (??0?$BaseTable@H@@QAE@XZ) referenced in function "public: __thiscall AccessLevels::AccessLevels(void)" (??0AccessLevels@@QAE@XZ) AccessLevels.obj
how do i fix this? i've asked a few other programmers at my company and nobody's had a clue.
thanks,
glenn
Code:
template <class T>
class BaseTable
{
public:
BaseTable(void);
~BaseTable(void);
};
template <class T>
BaseTable<T>::BaseTable(void)
{
}
template <class T>
BaseTable<T>::~BaseTable(void)
{
}
then, the class that inherits from this would look like...
Code:
#include "basetable.h"
class AccessLevels :
public BaseTable<int>
{
public:
AccessLevels(void);
~AccessLevels(void);
};
#include "AccessLevels.h"
AccessLevels::AccessLevels(void)
{
}
AccessLevels::~AccessLevels(void)
{
}
everything compiles fine when i just have the base template class. also, if i have the "accessLevels" class with the constructor and destructor removed (just the shell), it compiles fine. as soon as i include the constructor, the build process fails with a linker error...
Error 1 error LNK2019: unresolved external symbol "public: __thiscall BaseTable<int>::BaseTable<int>(void)" (??0?$BaseTable@H@@QAE@XZ) referenced in function "public: __thiscall AccessLevels::AccessLevels(void)" (??0AccessLevels@@QAE@XZ) AccessLevels.obj
how do i fix this? i've asked a few other programmers at my company and nobody's had a clue.
thanks,
glenn