编译通过,连接出错?
以下为输出错误:
IntArray.obj : error LNK2001: unresolved external symbol "void __cdecl swap(class IntArray &,int,int)" (?swap@@YAXAAVIntArray@@HH@Z)
IntArray.obj : error LNK2001: unresolved external symbol "public: __thiscall IntArrayRC::IntArrayRC(int *,int)" (??0IntArrayRC@@QAE@PAHH@Z)
IntArray.obj : error LNK2001: unresolved external symbol "public: __thiscall IntArray::IntArray(int *,int)" (??0IntArray@@QAE@PAHH@Z)
IntArray.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall IntArray::find(int)const " (?find@IntArray@@UBEHH@Z)
IntArray.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall IntArray::max(void)const " (?max@IntArray@@UBEHXZ)
IntArray.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall IntArray::min(void)const " (?min@IntArray@@UBEHXZ)
IntArray.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall IntArray::sort(void)" (?sort@IntArray@@UAEXXZ)
Debug/ArrayModule.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.
Creating browse info file...ArrayModule.exe - 8 error(s), 0 warning(s)
以下为输出错误:
IntArray.obj : error LNK2001: unresolved external symbol "void __cdecl swap(class IntArray &,int,int)" (?swap@@YAXAAVIntArray@@HH@Z)
IntArray.obj : error LNK2001: unresolved external symbol "public: __thiscall IntArrayRC::IntArrayRC(int *,int)" (??0IntArrayRC@@QAE@PAHH@Z)
IntArray.obj : error LNK2001: unresolved external symbol "public: __thiscall IntArray::IntArray(int *,int)" (??0IntArray@@QAE@PAHH@Z)
IntArray.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall IntArray::find(int)const " (?find@IntArray@@UBEHH@Z)
IntArray.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall IntArray::max(void)const " (?max@IntArray@@UBEHXZ)
IntArray.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall IntArray::min(void)const " (?min@IntArray@@UBEHXZ)
IntArray.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall IntArray::sort(void)" (?sort@IntArray@@UAEXXZ)
Debug/ArrayModule.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.
Creating browse info file...ArrayModule.exe - 8 error(s), 0 warning(s)
如果用DLL了,注意你的DLL对函数swap的声明,最好在你的DLL中加入def文件
申明了啊!
setting ->link
input
youliv.liv
project->setting->Link -->>Object/library mopdules 目录中