关于unresolved external symbol __CrtDbgReportW

来源:互联网 发布:mac mini 2016更新 编辑:程序博客网 时间:2024/06/15 11:25
1>Linking...
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>main.obj : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: bool __thiscall std::_Tree<class std::_Tset_traits<class Node,struct std::less<class Node>,class std::allocator<class Node>,0> >::const_iterator::operator==(class std::_Tree<class std::_Tset_traits<class Node,struct std::less<class Node>,class std::allocator<class Node>,0> >::const_iterator const &)const " (??8const_iterator@?$_Tree@V?$_Tset_traits@VNode@@U?$less@VNode@@@std@@V?$allocator@VNode@@@3@$0A@@std@@@std@@QBE_NABV012@@Z)
1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)

1>D:\proj\Test\Debug\Test.exe : fatal error LNK1120: 3 unresolved externals



很奇怪,一个很简单的只include了 <set>的小程序,不知道为啥linking不过。但是换成Release就过了。

后来发现是project property-> C++ -> Code Generation -> Runtime Library-> 是 /MT,改成/MTd就能在debug下过了。

我觉得很诡异,以前好像Debug和Release之间随便乱跳啊,怎么现在还要改设置了。