Handmade Hero»Forums»Code
23 posts
C runtime (CRT)

When compiling my code without the C runtime library, the linker always tells me to link with one or more of the following libraires:

libucrt.lib
ucrt.lib
libvcruntime.lib
vcruntime.lib

My questions are, why does it happen? What's the difference between these libraries, and what's the difference between their counterparts:

libucrtd.lib
ucrtd.lib
libvcruntimed.lib
vcruntimed.lib
Mārtiņš Možeiko
2566 posts / 2 projects
C runtime (CRT)

At some point MSVC split CRT library into multiple parts so they can share code for different reasons. One reason is to have code that is compiler specific (handling exceptions, internal functions) separate from actual runtime (like stdio functionality). vcruntime is such compiler specific code that is separate from common CRT code in ucrt.

libNAME.lib vs NAME.lib is difference between static vs dynamic libraries.
NAME vs NAMEd.lib for release vs debug libraries.

You can read more details on this here: https://learn.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features