Clang on windows (using msvc libs) links with libcmt
(the static runtime library) by default. Is there an easy way to link with the dynamic library (msvcrt
)?
Normally, clang adds -defaultlib:libcmt
to the linker command, which links the program to the static runtime. This occurrs even if the source file is blank.
The way I've found you can is by adding the options -Wl,-nodefaultlib:libcmt -D_DLL -lmsvcrt
to override the default. However, this seems quite awkward. Is there a better way of linking the dynamic runtime than this?
I had a similar problem and found I had to link against msvcrt, vcruntime and ucrt. See this post for more information https://devblogs.microsoft.com/cppblog/introducing-the-universal-crt/.
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