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).
I still don't understand what the problem is. In this case would I need implicit or explicit instantiation? According to the first link it is possible to split in into 2 files using explicit instantiation, however they state types "int" and "float" at the end. Does this not allow for other types (i.e. string) to be used?
From what I understand, I need implicit instantiation (so move everything to the header)...is this right?
According to the first link it is possible to split in into 2 files usingexplicit instantiation, however they state types "int" and "float" at the end. Does this not allow for other types (i.e. string) to be used? Nope, if you explicitly instantiate for int and float you can use only int and float
From what I understand, I need implicit instantiation (so move everything to the header)...is this right?