I'd like to (Windows, VS2019) statically link the VC++ runtime to my C++ application. The problem I'm having is that even if I set the /MT (Multi-threaded non-dll) option which should make the linker link statically to the runtime, it's not working. I get the error "mismatch detected for runtime library" for all those libraries which linked dynamically to the runtime. Basically' it's telling me that I can't link statically to the runtime if I have libraries that do not.
I've seen questions like this one where it says
If you are using any other libraries you may need to tell the linker to ignore the dynamically linked CRT explicitly.
Now I don't know how to do that or whether it'll work. My question is: is there a way to link my entire application statically to the VC++ runtime when the static libraries I have are linked dynamically to it?
Thank you everyone in advance
You could set Ignore Specific Default Libraries
in Properties->Linker->Input->Ignore Specific Default Libraries
.
If you want to link the entire application statically to the VC++ runtime, you need to set the options in debug
and release
.
1.Properties->Configuration Properties->General->Use of MFC->Use MFC in a Static Library(If you use MFC)
2.Properties->Configuration Properties->C/C++—Code Generation->Runtime Library->Multi-threaded(/MT)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.