I would like to be able to use mingw-w64 to build binaries that link to the Universal CRT available with Visual Studio 2015+ instead of MSVCRT.lib. The release notes for mingw-w64 v6.0.0 include the following: "Massive additions to support UCRT thanks to Martin Storsjö"
Unfortunately my searches have not revealed the documentation on how to use this support.
Does anyone know what options I need to supply and where to supply them?
Well, I have done it along with VS 2017. But as far as I understand both VS 2015 and VS 2017 use the
VCRUNTIME140.DLL
, so no worries here.It is divided into two steps:
1. Creating an import library for
VCRUNTIME140.DLL
:This is done by doing the following:
2. Change the way MinGW GCC operates to link against
VCRUNTIME140
andUCRT
instead ofMSVCRT
-D_UCRT
tocpp
andcc1plus
sections of the specs file. This will prevent undefined references linking errors for thescanf
functions family. Check my other question.-lmsvcrt
to-lvcruntime140 -lucrt
in thelibgcc
section of the specs file.Please exchange
$(MINGW_ROOT)
with the location of where u have MinGW.Notes:
i686-w64-mingw32
, within the paths I included may differ for your case. I believe based on the architecture. So you may have to modify that accordingly.libucrt.a
in the $(MINGW_ROOT)/i686-w64-mingw32/lib folder. I am using MinGW 7.0.0 with GCC 7.4.0.