c++visual-studioconfigurationvisual-studio-2019release-mode

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


Here I asked that I get LNK2001 error when I build my Visual C++ code through 'Release Mode', even though all my configuration settings between 'Release' and 'Debug' modes are the same (at least the ones I changed have been changed via 'all configurations').

I could solve the problem by changing Release mode: Configuration Properties -> C/C++ -> Code Generation -> Runtime Library from 'Multi-threaded DLL (/MD)' to 'Multi-threaded Debug DLL (/MDd)'. What does this tell me? Is what I did something odd (to take runtime library of Release from Debug)? Or does this imply that my 'Release' configurations are wrong?


Solution

  • I suggest you could refer to the 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.

    As far as I'm concerned, you are linking the Debug DLL in release mode. You should make sure you use the debug libraries in your debug builds, and retail libraries in your retail builds.