/MD, /MT, /LD(Use Run-Time Library)

/MD, /MT, /LD(Use Run-Time Library)

Indicates whether a multithreaded module is a DLL and specifies retail or debug versions of the run-time library.

  • 多线程模块是否为DLL
  • run-time library 是 retail 版本 还是 debug 版本

1. Syntax

/MD[d]
/MT[d]
/LD[d]

2. Remarks

/MD: Causes the application to use the multithread-specific 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 enables the linker to resolve external references. The actual working code is contained in MSVCRversionnumber.DLL, which must be available at run time to applications linked with MSVCRT.lib.

  • 应用使用指定为多线程,指定为DLL 的run-time library版本
  • 定义 _MT 和 _DLL
  • 造成编译器将库名 MSVCRT.lib 放入 .obj 文件
    使用此选项的应用静态链接 MSVCRT.lib,此库保证链接器解析外部引用。

/MDd: Defines _DEBUG, _MT, and _DLL and causes the application to use the debug multithread-specific 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.

/MT: Causes the 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.

  • 指定多线程,静态库

/MTd: 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.

    • 指定多线程,静态库,附带C运行时库调试信息

/LD: 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.

Interprets /Fe (Name EXE File) as naming a DLL rather than an .exe file. By default, the program name becomes basename.dll instead of basename.exe.

Implies /MT unless you explicitly specify /MD.

用于应用程序链接 run-time library

/LDd: 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 /clr (Common Language Runtime Compilation), see CRT Library Features.

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 about how to use the debug versions of the run-time libraries, see C Run-Time Library Reference.

For more about DLLs, see Create C/C++ DLLs in Visual Studio.

3. To set this compiler option in the Visual Studio development environment

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值