【发布时间】:2013-06-20 16:31:41
【问题描述】:
我有一个 DLL 项目,它可以编译、链接并与 Visual Studio 6 一起正常工作。
现在我已将其加载到 Visual Studio 2010 中。在导入旧的 .dsp 文件期间,VS2010 要求我转换为 .vcxproj 文件。之后我尝试编译新转换的项目,但在调试构建中偶然发现了这个奇怪的链接器错误:
error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: struct oapc_bin_head * const & __thiscall std::_Deque_const_iterator<struct oapc_bin_head *,class std::allocator<struct oapc_bin_head *> >::operator*(void)const " (??D?$_Deque_const_iterator@PAUoapc_bin_head@@V?$allocator@PAUoapc_bin_head@@@std@@@std@@QBEABQAUoapc_bin_head@@XZ)
_DEBUG 编译开关在调试模式下定义,NDEBUG 在发布模式下定义。令人惊讶的是,在发布模式下,错误完全不同:
error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xlength_error(char const *)" (__imp_?_Xlength_error@std@@YAXPBD@Z) referenced in function "protected: void __thiscall std::deque<struct oapc_bin_head *,class std::allocator<struct oapc_bin_head *> >::_Xlen(void)const " (?_Xlen@?$deque@PAUoapc_bin_head@@V?$allocator@PAUoapc_bin_head@@@std@@@std@@IBEXXZ)
任何想法在项目文件转换过程中丢失了什么?
谢谢!
【问题讨论】:
-
不,抱歉,没有帮助。 _DEBUG 在调试版本中是必需的,(不仅)assert() 如果不存在将无法正常工作。
-
至少解决了调试构建问题:必须针对 msvcrtd.lib 而不是 msvcrt.lib 进行链接
标签: visual-studio-2010 linker-errors visual-studio-6