I've been reading threads, issues, and posts for a while about the c-runtime and the library linking, but I'm still confused about how to set up these two parameters when using mixed triplet, as vcpkg provides separate settings for the two variables.
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
(I'm using Visual Studio under Windows OS)
What I've understood so far (simplified):
Md/Mt settings, and related to how modern cpp implementation interprets the c99 code.It seems using pure x64-windows triplet where everything is dynamic works most of the time, but there're advantages for using static version at some circumstances. I've tried different combinations (enable either of the two settings or enable both) in my x64-windows-mixed environment and different projects sometimes fail for the compilation.
Here is my question which I still cannot summarise good enough from the posts I read and need to ask here:
static libraries.P.S. I used to set both to static and only use dynamic for some libraries like Qt, but that gives me some issue on one of my projects. Then I use static only for the "library linkage", other issues for compilation emerges from some of the libraries...
I already know that once I changed the triplets, I need to re-install the package I used from vcpkg.
It'll be super appreciated if someone can help me to understand the overall concepts and in-between connections.
Thank you.
This is really not vcpkg specific. CRT linking should generally be consistent between all parts of your program unless the library interfaces have been carefully designed to allow mixing.
Compiling some libraries into shared libs and some into static should work in principle, but there can always be library specific reasons, why a particular combination doesn't work.
Please reopen if it still be a probem for you.
Most helpful comment
This is really not vcpkg specific. CRT linking should generally be consistent between all parts of your program unless the library interfaces have been carefully designed to allow mixing.
Compiling some libraries into shared libs and some into static should work in principle, but there can always be library specific reasons, why a particular combination doesn't work.