I have some trouble with inheritance from a template class. The code below does not compile, showing this error : main.cpp : undefined reference to OBJ1<1000>::method()
parent.h
template <int nb> class PARENT { PARENT() {}; ~PARENT() {}; virtual void method() = 0; enum { nb_ = nb }; }; obj1.h
#include "parent.h" template <int nb> class OBJ1 : public PARENT<nb> { virtual void method(); }; obj1.cpp
#include "obj1.h" template <int nb> void OBJ1<nb>::method() { //code } main.cpp
#include "obj1.h" int main() { OBJ1<1000> toto; toto.method(); } Where am I wrong ?