<分区>
Possible Duplicate:
Why can templates only be implemented in the header file?
我在非模板类中编写了模板方法。这个项目是静态库。 然后我编写了测试控制台应用程序并想使用这种方法。但是有编译错误(unresolved external)。然后我问谷歌并找到论坛(http://cboard.cprogramming.com/cplusplus-programming/108544-static-libraries-template-functions.html),其中'matsp'说:“使用模板时,整个模板实现需要在头文件中。”。我确实像他说的那样,而且效果很好。为什么?