About the pit of the VS compilation connection. (/ MT) (/ MTD) (/ MD) (/ MDD)

tags: Microsoft  Library  visual studio

OldNames.Lib (read.obi): Error LNK2001: External symbol __imp__read

 

Microsoft gives the program that the runtime used by the default is (/ MD) (/ MDD) is a dynamic runtime. Sometimes it contains a third-party library, a link is a bunch of error, then run the library to change (/ MT) (/ MTD) will be able to link. But if you accidentally include other libraries, other libraries are generated using (/ MD) (/ MDD), and the result may be reported to this type of fault. Very wonderful, this library should exist, and he said that the link can't.

The purpose of writing this article is to remind yourself that Microsoft's runtime is a pit, and another possibility that can be linked may be that the run library used in the library generated by you may not match.

Attach the CMAKE configuration item I often use:

 set(CompilerFlags
    CMAKE_CXX_FLAGS
    CMAKE_CXX_FLAGS_DEBUG
    CMAKE_CXX_FLAGS_RELEASE
    CMAKE_C_FLAGS
    CMAKE_C_FLAGS_DEBUG
    CMAKE_C_FLAGS_RELEASE)
                
foreach(CompilerFlag ${CompilerFlags})
                                string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
                                string(REPLACE "/Ob0" "" ${CompilerFlag} "${${CompilerFlag}}")
                                string(REPLACE "/TC" "" ${CompilerFlag} "${${CompilerFlag}}")
 endforeach()

 

Intelligent Recommendation

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...

Openssl windows compile 64 bit mt mtd md mdd

reference: Openssl source download address:https://www.openssl.org/source/I used openssl-1.1.0i First install ActivePerl:https://www.activestate.com/activeperl/downloadsAfter loading it, if you start ...

Some links and problems between MTD/MT/MDD/MD and LIB/DLL

Where do you start talking about this topic? The blogger Xiaobai one, recently debugged the program (WIN-MSVC) and did not understand some basic problems, in line with the principle of meeting the pro...

VC++ compile-time runtime library selection (/MT, /MTd, /MD, /MDd)

In VS, there are four options in project properties-"C/C++-"Code generation -" runtime library options: multi-threaded (/MT), multi-threaded debugging (/MTd) , Multi-threaded DLL (/MD),...

Qt sets the runtime library MT, MTd, MD, MDd in pro

Qt sets the runtime library MT, MTd, MD, MDd in pro, focusing onQMAKE_CFLAGS Multi-threaded debugging Dll (/MDd) corresponds to MD_DynamicDebug Multi-threaded Dll (/MD) corresponds to MD_DynamicReleas...

More Recommendation

CMAKE Set MSVC Engineering MT/MTD/MD/MDD

Articles directory 0. Foreword 1. How to set up 1.1 Cmakelists code 1.2 Point 1: Policy 1.3 Key points 2: set_proprty 0. Foreword existMSVCEngineeringRight-click-> Properties,turn upConfiguration a...

libcef-compile operation mode-MTD/MT-MDD/MD

Article Directory 1. Open the project 2. Modify options 3. Verification test In an embedded running environment, most of the host software may use the MD mode to load and run the C++ runtime library. ...

VC runtime library /MD, /MDd and /MT, /MTd (to convert)

Let’s summarize their differences here. The 'd' behind represents the DEBUG version, and the RELEASE version without 'd' is the RELEASE version. First of all, /MT /MT is "multithread, stati...

Multi-threaded (/ MT) VS in, multi-threaded debugging (/ MTd), the difference between multi-threaded DLL (/ MD), debugging multi-threaded DLL (/ MDd) of

A language development environment often comes with language libraries, which is the API of the operating system for the packaging, we also call these language runtime library. For MSVC runtime (CRT),...

Understanding of /MT, /MTd, /MD, /MDd options when compiling static and dynamic link libraries for VC

Most people know that in the Windows development process, to achieve code reuse, it will be packaged into an interface, and then packaged into a library form, which has a static library and a dynamic ...

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

Top