I have a pretty simple Doubly Linked List implementation (only the constructor and destructor so far), but I get this error (ide is VS 2008):
Error 1:
Description:
error LNK2019: unresolved external symbol "public: __thiscall CustomList<int>::~CustomList<int>(void)" (??1?$CustomList@H@@QAE@XZ) referenced in function _main File:
driverCustom.obj
Error 2:
Description:
error LNK2019: unresolved external symbol "public: __thiscall CustomList<it>::CustomList<int>(void)" (??0?$CustomList@H@@QAE@XZ) referenced in function _main File:
driverCustom.obj
I know the error has to do with my use of template. The weird thing is that it compiles perfectly when I just copy-paste the constructor and destructor code into their respective declarations, so I don't think anything is wrong with the actual code.
Here are my files: CustomList.h (interface), CustomList.cpp (implementation), driverCustom.cpp (driver).
You didn't include any code, but given that CustomList is a template class and you have a source file for it, your problem is that all of the template code must exist in the header. Template classes cannot have any code in source files. This is because the compiler has to have all of the class code at the point of template instantiation in order to specialize the code completely.