VS runtime MT, MD of difference

https://www.jianshu.com/p/f43afc1d5946

VC Project Properties → Configuration Properties → C / C ++ → code generation → runtime library can be used are: multi-threaded (/ MT), multi-threaded debugging (/ MTd), multi-threaded DLL (/ MD), multi-threaded debug DLL (/ MDd), single-threaded (/ ML), single-threaded debug (/ MLd).

Currently Win7, Win10, etc., select the MD is not a problem, but XP and some older systems need to choose MT

The difference between the two

/ MT is "multithread, static version" means that a multithreaded static version, after it is defined, the compiler LIBCMT.lib relocated to the OBJ file, so that the linker uses LIBCMT.lib handle external symbols.

/ MD is "multithread- and DLL-specific version", meaning multi-threaded DLL version, after it is defined, the compiler MSVCRT.lib relocated to the OBJ file, it is connected to the way the DLL is statically linked, in fact, work the library is mSVCR80.DLL.

which is:

Static runtime library: LIBCMT.lib

Dynamic runtime library: MSVCRT.lib + MSVCR80.DLL

So, when you use CMAKE generate project files, if CMAKE with / MT generated (see the original project directory CMakeLists.txt), the runtime library it calls for: LIBCMT.lib, run if the resulting project library (runtime library) you select / MD, this project is linked when compiled, will be called dynamic runtime library: MSVCRT.lib + mSVCR80.DLL, obviously, for the same library twice a runtime different library function call error redefined appears. If this project is generated when the library file, then call this other engineering libraries must also be / MT.

Guess you like

Origin www.cnblogs.com/hei-hei-hei/p/11424358.html