解决Link 2001错误的一种方法

首先感谢:http://www.cppblog.com/kenlistian/archive/2008/11/14/66872.html

我想将PhysX SDK中的一个Sample(SampleRayCar) 独立出来。
我把所有原例子中的cpp和h文件都考到我新建的工程目录下之后,编译过了,但是连接出了问题,不知道怎么解决。

错误信息:

 

Car.obj : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: bool __thiscall std::_Tree<class std::_Tmap_traits<float,float,struct std::less<float>,class std::allocator<struct std::pair<float const ,float> >,0> >::const_iterator::operator==(class std::_Tree<class std::_Tmap_traits<float,float,struct std::less<float>,class std::allocator<struct std::pair<float const ,float> >,0> >::const_iterator const &)const " (??8const_iterator@?$_Tree@V?$_Tmap_traits@MMU?$less@M@std@@V?$allocator@U?$pair@$$CBMM@std@@@2@$0A@@std@@@std@@QBE_NABV012@@Z)
1>NxAllVehicles.obj : error LNK2001: unresolved external symbol __CrtDbgReportW
1>NxVehicle.obj : error LNK2001: unresolved external symbol __CrtDbgReportW

我没注意到上面还有一个warning,如下:

LINK : warning LNK4098: 默认库“LIBCMT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library

从这个warning中推断出来,是运用了错误的运行库包。

 

在一程序中使用不同类型的运行时库或使用调试和非调试版本的运行时库,则将收到此链接错误。

例如,编译一个文件以使用一种运行时库,而编译另一个文件以使用另一种运行时库(例如单线程运行时库对多线程运行时库),试图链接它们,则

将得到此警告。应将所有源文件编译为使用同一运行时库。

其实就是调正编译器选项参数:/MD、/MT 和 /LD

在vc8中,在“配置属性-->C/C++-->代码生成-->运行时库”中将“多线程(/MT)”统一改为“多线程调试(/MTd)”即可。

转载于:https://www.cnblogs.com/CoolSummer/articles/2510473.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值