Error with c++ code, templates?

This is how I call the function: Zombie dan; room[i][k].commenceFight<Zombie>(dan); This is how the function is defined in the .cpp file: template <typename T> void Room::commenceFight(T mob) { mob.enemyDialogue(); cout << mob.calculateDamage(); } This is how the function is defined in the... show more This is how I call the function:

Zombie dan;
room[i][k].commenceFight<Zombie>(dan);

This is how the function is defined in the .cpp file:

template <typename T>
void Room::commenceFight(T mob)
{
mob.enemyDialogue();
cout << mob.calculateDamage();

}

This is how the function is defined in the header file:

template <typename T>
void commenceFight(T);



When I run this code, I get this error.

Severity Code Description Project File ... State
Error LNK2019 unresolved external symbol "public: void __thiscall Room::commenceFight<class Zombie>(class Zombie)" (??$commenceFight@VZombie@@@Room@@QAEXVZ... referenced in function "public: void __thiscall Dungeon::test(void)" (?test@Dungeon@@QAEXXZ) FinalProject C:\...


I am new to using templates, so perhaps I am doing something wrong? Any help is appreciated.
2 answers 2