/MD, /MT, /LD (Use Run-Time Library)
Lets you indicate if a multithreaded module is a DLL and select retail or debug versions of the run-time library.
Causes your application to use the multithread- and DLL-specific version of the run-time library. Defines _MT and _DLL and causes the compiler to place the library name MSVCRT.lib into the .obj file.
Applications compiled with this option are statically linked to MSVCRT.lib. This library provides a layer of code that allows the linker to resolve external references. The actual working code is contained in MSVCR80.DLL, which must be available at run time to applications linked with MSVCRT.lib.
When /MD is used with _STATIC_CPPLIB defined (/D_STATIC_CPPLIB) it will cause the application to link with the static multithread Standard C++ Library (libcpmt.lib) instead of the dynamic version (msvcprt.lib) while still dynamically linking to the main CRT via msvcrt.lib.
Defines _DEBUG, _MT, and _DLL and causes your application to use the debug multithread- and DLL-specific version of the run-time library. It also causes the compiler to place the library name MSVCRTD.lib into the .obj file.
Causes your application to use the multithread, static version of the run-time library. Defines _MT and causes the compiler to place the library name LIBCMT.lib into the .obj file so that the linker will use LIBCMT.lib to resolve external symbols.
Defines _DEBUG and _MT. This option also causes the compiler to place the library name LIBCMTD.lib into the .obj file so that the linker will use LIBCMTD.lib to resolve external symbols.
Creates a DLL.
Passes the /DLL option to the linker. The linker looks for, but does not require, a DllMain function. If you do not write a DllMain function, the linker inserts a DllMain function that returns TRUE.
Links the DLL startup code.
Creates an import library (.lib), if an export (.exp) file is not specified on the command line; you link the import library to applications that call your DLL.
Interpretsas naming a DLL rather than an .exe file; the default program name becomes basename.dll instead of basename.exe.
Implies /MT unless you explicitly specify /MD.
Creates a debug DLL. Defines _MT and _DEBUG.
For more information about C run-time libraries and which libraries are used when you compile with, see .
All modules passed to a given invocation of the linker must have been compiled with the same run-time library compiler option (/MD, /MT, /LD).
For more information on using the debug versions of the run-time libraries, see.
Knowledge Base article Q140584 also discusses how to choose the appropriate C run-time library.
For further discussion of DLLs, see.
To set this compiler option in the Visual Studio development environment
Open the project's Property Pages dialog box. For details, see.
Click the C/C++ folder.
Click the Code Generation property page.
Modify the Runtime Library property.
To set this compiler option programmatically