vs2010 编译release没问题debug编译不通过

------ 已启动全部重新生成: 项目: VM661JTcpDLL, 配置: Debug Win32 ------
生成启动时间为 2018-12-29 14:07:20。
项目文件包含 ToolsVersion="15.0" 设置,而此版本的 MSBuild 不支持该工具版本。该项目将视为包含 ToolsVersion="4.0" 设置。
……………………………………………………………………………………
Link:
正在创建库 ....DebugVM661JTcpDLL.lib 和对象 ....DebugVM661JTcpDLL.exp
LINK : warning LNK4098: 默认库“LIBCMT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
VM661JTcpDLL.obj : error LNK2019: 无法解析的外部符号 __CrtDbgReportW,该符号在函数 "public: char const & __thiscall std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >::operator*(void)const " (??D?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDXZ) 中被引用
libcpmtd.lib(stdthrow.obj) : error LNK2001: 无法解析的外部符号 __CrtDbgReportW
VM661JTcpDLL.obj : error LNK2019: 无法解析的外部符号 __free_dbg,该符号在函数 "private: void __thiscall std::_Yarn<char>::_Tidy(void)" (?_Tidy@?$_Yarn@D@std@@AAEXXZ) 中被引用
libcpmtd.lib(xdebug.obj) : error LNK2001: 无法解析的外部符号 __free_dbg
libcpmtd.lib(locale0.obj) : error LNK2001: 无法解析的外部符号 __free_dbg
libcpmtd.lib(xdebug.obj) : error LNK2019: 无法解析的外部符号 __malloc_dbg,该符号在函数 "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) 中被引用
libcpmtd.lib(locale0.obj) : error LNK2001: 无法解析的外部符号 __malloc_dbg
libcpmtd.lib(_tolower.obj) : error LNK2019: 无法解析的外部符号 __calloc_dbg,该符号在函数 __Getctype 中被引用
....DebugVM661JTcpDLL.dll : fatal error LNK1120: 4 个无法解析的外部命令

生成失败。

已用时间 00:00:05.42
========== 全部重新生成: 成功 0 个,失败 1 个,跳过 0 个 ==========

解决办法:

如果release版运行库选择为/MT,则debug版运行库选择为/MTd

原文地址:https://www.cnblogs.com/rixiang/p/10195803.html