##A.hh
template<class T> void func(T t) {}
template<> void func<int>(int t) {}
void func2();
##A.cpp
void func2() {}
##main.cpp
func("hello");
func(int());
我得到的错误是:error LNK2005: "void __cdecl func(int)" (??$func@H@@YAXH@Z) 已经在 A.obj 中定义,找到一个或多个多重定义的符号
函数模板特化不被视为普通函数模板吗?看起来它将在 A 的目标文件中。