visual studio linker warning LNK4098

别说谁变了你拦得住时间么 提交于 2019-12-05 13:10:17

It sounds like you could be running a debug library and a release compiled library in the same build.

Go through your project options and select to use the debug versions of any 3rd party libraries you use.

It says what the problem is right in the message if you read carefully: "MSVCRT.lib" vs "msvcrtd.lib"

Notice the added "d" in the second library name. What happens is that you are linking to the visual studio C++ runtime (MSVCRT) statically. One of your libraries is pulling the release version of that lib while another is pulling the debug version (hence the postfix "d"). The linker tells you that both libs define functions with the same name, are in conflict and thus one of them gets dropped automatically.

To fix this, go through the build settings of all your projects/libraries and make sure that they are using the same runtime libraries for all build configurations. Look in project properties -> C/C++ -> Code Generation -> Runtime Library. This should probably read "multi-threaded" for release builds and "multi-threaded debug" for debug builds.

Note that it is generally considered bad practice to link these libraries statically and that you should prefer the dynamically linked dll versions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!