'Calling a function of a template class, in a template function?
I'm trying to call a member function of a template class inside of a member function as follows:
Caller:
i->scene->AddComponent<MeshRenderEntityData>(child);
Template function (in header):
template<class cTy>
void AddComponent(DEntity e)
{
DComponentStorage<cTy>* cs = this->template GetComponentStorage<cTy>();
cs->RegisterEntity(e);
}
This is causing a linker error. Without the line cs->RegisterEntity(e); it compiles just fine. I want it to call the function of the template class from within the template function. The call to AddComponent() is from an exe, but the class containing that function is in a dll. Is what I'm trying to do even possible?
The error:
LNK2019 unresolved external symbol "__declspec(dllimport) public: void __cdecl dengine::DComponentStorage::RegisterEntity(unsigned __int64)" (_imp?RegisterEntity@?$DComponentStorage@VMeshRenderEntityData@dengine@@@dengine@@QEAAX_K@Z) referenced in function "public: void __cdecl dengine::DScene::AddComponent(unsigned __int64)" (??$AddComponent@VMeshRenderEntityData@dengine@@@DScene@dengine@@QEAAX_K@Z) dtest R:\dengine\dtest\dtest.obj 1
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
