main.obj : error LNK2001: unresolved external symbol "public: __thiscall CStack<float>::~CStack<float>(void)" (??1?$CStack@M@@QAE@XZ)
main.obj : error LNK2001: unresolved external symbol "public: __thiscall CStack<int>::~CStack<int>(void)" (??1?$CStack@H@@QAE@XZ)
main.obj : error LNK2001: unresolved external symbol "public: int __thiscall CStack<int>::pop(int &)" (?pop@?$CStack@H@@QAEHAAH@Z)
main.obj : error LNK2001: unresolved external symbol "public: int __thiscall CStack<int>::push(int const &)" (?push@?$CStack@H@@QAEHABH@Z)
main.obj : error LNK2001: unresolved external symbol "public: __thiscall CStack<int>::CStack<int>(int)" (??0?$CStack@H@@QAE@H@Z)
main.obj : error LNK2001: unresolved external symbol "public: int __thiscall CStack<float>::pop(float &)" (?pop@?$CStack@M@@QAEHAAM@Z)
main.obj : error LNK2001: unresolved external symbol "public: int __thiscall CStack<float>::push(float const &)" (?push@?$CStack@M@@QAEHABM@Z)
main.obj : error LNK2001: unresolved external symbol "public: __thiscall CStack<float>::CStack<float>(int)" (??0?$CStack@M@@QAE@H@Z)
Debug/TemplateClass.exe : fatal error LNK1120: 8 unresolved externals
在定义类模板时候,必须放在.h文件中,不能分放到.cpp文件中
否则链接无法通过
在网上查了之后知道
目前没有编译器支持对于模板的定义和声明分开放
而且在向导中定义Create Implement 直接实现函数到同一个.h文件中