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”,但不知道对工程是否有负面影响。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值