Let's say I have this template class declared in my animal.hpp file:
enum class ANIMAL_TYPE{
     DOG,
     CAT,
};
template <ANIMAL_TYPE T>
class animal{
public:
    void makeSound();
    };
Pretty classic example used in explanations of interfaces and inheritance, but I want it to be known at compile time, and not be a virtual function, so I implemented it like this in the animal.cpp file:
template <>
class Animal<ANIMAL_TYPE::DOG>{
public:
    void makeSound(){
         std::cout << "woof";
    }
};
template <>
class Animal<ANIMAL_TYPE::CAT>{
public:
    void makeSound(){
         std::cout << "MEOW";
    }
};
template class Animal<ANIMAL_TYPE::DOG>;
template class Animal<ANIMAL_TYPE::CAT>;
And this in the main file:
#include <animal.hpp>
int main(){
    Animal<ANIMAL_TYPE::DOG> doggy;
    doggy.makeSound();
    return 0;
}
But when I compile and link this, I get an error during linking "undefined reference to Animal<(ANIMAL_TYPE)0>::makeSound"
 
     
    