`
javayestome
  • 浏览: 1006740 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

fatal error LNK1120: 3 unresolved externals错误处理

阅读更多

用vs2005写c++项目,定义了AList类,在AList.h中写了类定义,有3个函数不是inline的,定义写在了AList.cpp中。但每次编译项目,那3个函数便报错

DataStruct.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall AList<int>::insert(int const &)" (?insert@?$AList@H@@UAE_NABH@Z)
DataStruct.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall AList<int>::append(int const &)" (?append@?$AList@H@@UAE_NABH@Z)
DataStruct.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall AList<int>::remove(int &)" (?remove@?$AList@H@@UAE_NAAH@Z)

解决这个错误可以:

1、使用了template,类定义和函数实现要在同一个文件。

2、可以include“AList.cpp”,但不知道对工程是否有负面影响。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics