类模板的问题!
template<class type>class abcd{
public:
void gg(type,type);
};
template<class type>void gg(type a,type b){
type c=a*b;
cout<<c<<endl;
}
int main(int argc, char* argv[])
{
abcd<int> ho;
ho.gg(1,2);
return 1;
}
编译的时候出错,提示说:
ha.obj : error LNK2001: unresolved external symbol "public: int __thiscall abcd<int>::gg(int,int)" (?gg@?$abcd@H@@QAEHHH@Z)
Debug/ha.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
怎么回事?代码好象没错啊。