Visual C++:发布模式的运行时库为'Multi-threaded Debug DLL'

Visual C++: Runtime Library of Release Mode as 'Multi-threaded Debug DLL'

Here 当我通过 'Release Mode' 构建我的 Visual C++ 代码时,我问我收到 LNK2001 错误,即使我的所有配置设置都在 'Release' 和 'Debug' 模式之间是一样的(至少我改的是通过'all configurations'改的)。

我可以通过更改发布模式来解决问题:配置属性 -> C/C++ -> 代码生成 -> 运行时库从 'Multi-threaded DLL (/MD)' 到 'Multi-threaded Debug DLL (/MDd)'。这告诉我什么?我做了什么奇怪的事情(从调试中获取 Release 的运行时库)?或者这是否意味着我的 'Release' 配置有误?

我建议你可以参考Linker Tools Error LNK2001

If you link to the release mode libraries when building a debug version of an application. Similarly, if you use options /MTd or /MDd or define _DEBUG and then link to the release libraries, you should expect many potential unresolved externals, among other problems. Linking a release mode build with the debug libraries also causes similar problems. To fix this issue, make sure you use the debug libraries in your debug builds, and retail libraries in your retail builds.

据我所知,您正在以发布模式链接调试 DLL。您应该确保在调试版本中使用调试库,在零售版本中使用零售库。