Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Template class - unresolved external symbol(s) [duplicate]

I get this error a LOT, and i never know why. Can someone help me find the cause of it?

Edit:Removed code

like image 243
Bob Avatar asked Nov 17 '25 13:11

Bob


2 Answers

Put the implementation (your method definitions) into the header along with the class declaration (see this in the C++ FAQ). Some compilers have supported an "export" keyword for doing it the way that you did, but that has been nixed in the C++0x.

like image 165
jonsca Avatar answered Nov 19 '25 02:11

jonsca


Templates must be defined in header files. See these FAQs for more info:

  • Why can't I separate the definition of my templates class from its declaration and put it inside a .cpp file?
  • How can I avoid linker errors with my template functions?
like image 30
ildjarn Avatar answered Nov 19 '25 02:11

ildjarn