How do I check what runtime library a static library (.lib) in Windows has linked to?
I'm compiling my project with /MDd and I presume a library I'm linking to is using /MTd Multi-threaded Debug
Error 7 error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmtd.lib(xlock.obj) C:\...\msvcprtd.lib(MSVCP100D.dll)
LIBCPMTD.LIB = Multithreaded, static link
I know there's an option /NODEFAULTLIB:"libcpmtd.lib"
which I've tried and succeeded with, but I'd rather avoid that.
A LIB file contains a library of information used by a specific program. It may store a variety of information, which may include functions and constants referenced by a program or actual objects, such as text clippings, images, or other media.
The Microsoft Library Manager (LIB.exe) creates and manages a library of Common Object File Format (COFF) object files. LIB can also be used to create export files and import libraries to reference exported definitions. You can start this tool only from the Visual Studio command prompt.
The Universal CRT (UCRT) contains the functions and globals exported by the standard C99 CRT library. The UCRT is now a Windows component, and ships as part of Windows 10 and later versions. The static library, DLL import library, and header files for the UCRT are now found in the Windows SDK.
I was able to fix this doing the following
> dumpbin /DIRECTIVES C:\..\ThirdParty\tidy\windows\lib\libtidy
.lib
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file C:\..\ThirdParty\tidy\windows\lib\libtidy.lib
File Type: LIBRARY
Linker Directives
-----------------
/DEFAULTLIB:"LIBCMT"
/DEFAULTLIB:"OLDNAMES"
...
It's cleary linking to MT. I recompiled the lib using /MDd and it linked fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With