I have a problem with undefined templated member function used in main.
Error:
"CMakeFiles/Framework.dir/source/src/main.cpp.o: In function `main':
main.cpp:(.text +0x33): undefined reference to `unsigned int EntityMgr::crea teEntity<Entity >()'"
Can someone please help me understand why the EntityMgr::crea teEntity function is undefined from main?
Current setup (simplified):
EntityMgr.cpp:
main.cpp:
Error:
"CMakeFiles/Framework.dir/source/src/main.cpp.o: In function `main':
main.cpp:(.text +0x33): undefined reference to `unsigned int EntityMgr::crea teEntity<Entity >()'"
Can someone please help me understand why the EntityMgr::crea teEntity function is undefined from main?
Current setup (simplified):
Code:
//EntityMgr.hpp
#include "Entity.hpp"
class EntityMgr
{
template<typename>
unsigned int createEntity();
}
// Entity.hpp:
class Entity
{
//
};
Code:
template<typedef Class>
unsigned int EntityMgr::createEntity()
{
...
}
main.cpp:
Code:
#include "EntityMgr.hpp"
int main()
{
EntityMgr entityMgr;
entityMgr.createEntity<Entity>(); <--- Problem line.
return 0;
}
Comment