今天调试c++ primer 上的程序,出现了莫名奇妙的链接错误~
程序很简单就是定义一个数组类模版~ 我将类定义和类实现分别放在array.h 和array.cpp两个文件中~换了三个编译器也不行~
下面是在vs2005中的错误提示:
1>test.obj : error LNK2019: 无法解析的外部符号 "void __cdecl swap<int>(class Array<int> &,int,int)" (??$swap@H@@YAXAAV?$Array@H@@HH@Z),该符号在函数 _main 中被引用
1>test.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall Array<int>::Array<int>(class Array<int> const &)" (??0?$Array@H@@QAE@ABV0@@Z),该符号在函数 _main 中被引用
1>test.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall Array<int>::Array<int>(int *,int)" (??0?$Array