VS2012编译文件报错——error LNK2001: 无法解析的外部符号 __imp___CrtDbgReportW

错入显示如:

1>  正在生成代码...
1>SurfDescriptor.obj : error LNK2001: 无法解析的外部符号 __imp___CrtDbgReportW
1>Validate.obj : error LNK2001: 无法解析的外部符号 __imp___CrtDbgReportW
1>Visualize.obj : error LNK2001: 无法解析的外部符号 __imp___CrtDbgReportW
1>FastHessian.obj : error LNK2019: 无法解析的外部符号 __imp___CrtDbgReportW,该符号在函数 "public: bool __thiscall std::_Tree_const_iterator<class std::_Tree_val<struct std::_Tree_simple_types<struct std::pair<int const ,class ResponseLayer *> > > >::operator==(class std::_Tree_const_iterator<class std::_Tree_val<struct std::_Tree_simple_types<struct std::pair<int const ,class ResponseLayer *> > > > const &)const " (??8?$_Tree_const_iterator@V?$_Tree_val@U?$_Tree_simple_types@U?$pair@$$CBHPAVResponseLayer@@@std@@@std@@@std@@@std@@QBE_NABV01@@Z) 中被引用
1>IPoint.obj : error LNK2001: 无法解析的外部符号 __imp___CrtDbgReportW
1>main.obj : error LNK2001: 无法解析的外部符号 __imp___CrtDbgReportW
1>Surf.obj : error LNK2001: 无法解析的外部符号 __imp___CrtDbgReportW
1>C:\Users\Administrator\Desktop\Surf-master\Debug\Surf.exe : fatal error LNK1120: 1 个无法解析的外部命令
========== 全部重新生成: 成功 0 个,失败 1 个,跳过 0 个 ==========


解决方案:

像这种情况,可以推测运用了错误的运行库包。

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

例如,编译一个文件以使用一种运行时库,而编译另一个文件以使用另一种运行时库(例如单线程运行时库对多线程运行时库),试图链接它们,则将得到此警告。应将所有源文件编译为使用同一运行时库。

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

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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值