我有一些模板:
template <Class T>
class CsHashCase{
CsHashCase();
~CsHashCase();
...
};
template <class T> CsHashCase<T>::CsHashCase()
{
...
}
template <class T> CsHashCase<T>::~CsHashCase()
{
...
}
在某些类中,我需要创建一个这个模板的类:
#include "TmHashCase.h"
class CsSomeClass{
CsHashCase<int> * GbHashCase;
CsSomeClass(); // Constructor
};
// Constructor
CsSomeClass::CsSomeClass()
{
GbHashCase = new CsHashCase<int>;
}
但编译器向我显示错误:
undefined reference to `CsHashCase<int>::CsHashCase()
undefined reference to `CsHashCase<int>::CsHashCase()
如何正确做到?