Hello !
I'm doing a project for my Bachelor's Degree (which is an implementation of a simple Entity Component System, but that's not the point of my topic :p), but I have an error and I don't understand why. I'm getting the error "Undefined reference to `void MyClass::MyFunction<T>()`", I don't understand why since my function is well defined and the implementation file of the class is compiled...
Here's the header and the cpp file of the class who give me this problem :
The template member functions need to be placed in the header file.
When compiling Manager.cpp, the compiler does not know what <T> is, so none of the template member functions are expanded and compiled.
If you put the template function definitions in the header file, then when they are called (in main() or wherever) the compiler will see what expansions are needed, and compile them accordingly.