The difference between multithreading (/MT), multithreaded debugging (/MTd), multithreaded DLL (/MD), multithreaded debugging DLL (/MDd) in VS

A language development environment often comes with a language library, which is a wrapper around the operating system's API. We also call these language libraries a runtime library.

For the MSVC runtime library (CRT), according to the static / dynamic link, can be divided into static version and dynamic version; according to debugging / release, can be divided into debug version and release version; according to single thread / multi-thread, can be divided into single thread Version and multi-threaded version (but currently no single-threaded version is available in VS)

In debug mode, use the debug runtime: multithreaded debugging (/MTd), multithreaded debugging DLL (/MDd)

In release mode, use the release runtime: multithreaded (/MT), multithreaded DLL (/MD)

Run the library with debug d in debug mode, but the release mode does not. The difference between debugging and publishing is that the publishing mode omits the debugging information of the program. Simply put, the content for debugging in the debugging mode is deleted, so in general, the size of the executable file generated in the publishing mode is smaller than the debugging mode. Under the generation is small

Static linking: multi-threaded (/MT), multi-threaded debugging (/MTd)

Dynamic linking: multi-threaded DLL (/MD), multi-threaded debugging DLL (/MDd)

The dynamic link is D and the static link is T. The difference between the two is that the static link integrates the runtime library that the program depends on into the executable file, and the executable file no longer needs to run the runtime; the dynamic link does not integrate the runtime library that the program depends on into the executable file. The runtime is required to run the executable. Since the static link integrates the runtime that the program depends on into the executable file, in general, the size of the generated executable file is larger than that generated by the dynamic link.

The selection of these four runtimes in the VS project properties - "C / C + + -" code generation - "running library:

 

Instance

Source code:

 
  1.  
  2. #include <iostream>

  3. using namespace std;

  4.  
  5. int main()

  6. {

  7. cout << "Hello World!" << endl;

  8. system("pause");

  9. return 0;

  10. }

(The following experiments were completed under Win10+VS2017)

Win32, debug mode:

Win32, release mode:

We can find that in the same mode, the dynamic link is smaller than the static link; under the same kind of link, the release mode is smaller than the debug mode.

In x64, debug mode:

In x64, release mode:

Under the same mode and link, the executable file size generated under x64 is larger than that generated under Win32.

Intelligent Recommendation

VC runtime library / MD, / MDd and / MT, / MTd

https://blog.csdn.net/leepwang/article/details/8539414 There was a time in the program is written cuda appeared error LNK2005: _exit been defined like MSVCRTD.lib (MSVCR71D.dll) similar mistakes The r...

Decision DLL is MD or MDD

Visual Studio provides corresponding tools to query DLL, LIB information Open PowerShell, enter the VS installation directory, as follows: My installation path isC:\Program Files (x86)\Microsoft Visua...

C/C++ runtime library in VS project properties: MT, MTd, MD, MDd

original: C/C++ runtime library in VS project properties: MT, MTd, MD, MDd The article is reproduced from:      In each version of the compiler, we can configure the type of C and C++ runtim...

Qt sets the runtime library MT, MTd, MD, MDd in pro, only suitable for the VS version of Qt

Transfer from: http://blog.csdn.net/caoshangpa/article/details/51416077 1. Set the runtime library in pro Recently, the following error occurred when using Qt5.6.0 (VS2013 version) to call a static li...

5. Multithreaded debugging of gdb learning

First paste the code in this section The above is a multi-threaded programming to find a range of prime numbers, compiling need to usegcc -g thread.c -lpthread, Add thread link library, otherwise prog...

More Recommendation

vs DLL debugging

In a dynamic library project set as follows is then run directly on it DLL if found invalid dynamic library run the breakpoints is because it has a new dynamic code library changes, resulting in the u...

VS debugging python in DLL

Reference: https: //blog.csdn.net/sagittarius_warrior/article/details/72832696 VS debugging python in DLL This paper mainly talked about the previous two articles "LicenseSystem" program as ...

Multithreaded

The output is: One is to put the thread in a thread pool, the other is to use the blocking method, the counter, when the counter is 0, it means that the thread has been executed!...

#visual studio# Runtime library MT, MTd, MD, MDd

In the development of the window program is often encountered when the compiled program is not able to run on another machine, which is generally caused by the installation of the corresponding runtim...

MT, MTd, MD, MDd explain MSVCRTD.LIB and LIBCMTD.LIB conflicts

Transfer from: The project development process encountered MSVCRTD.LIB and LIBCMTD.LIB conflicts, and later found the reason is that the code compiler compile c / c + + runtime version is not the same...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top