Search code examples
c++visual-studio-2015crt

How to I update my C++ project in Visual Studio 2015 to use the new Universal CRT?


After VS2015 updated my project to the new Platform toolset v140, it fails to build due to a linker error : LNK1104 cannot open file 'libucrt.lib'.

It appears this library has been moved around due to the new Universal CRT as mentioned in this article : http://blogs.msdn.com/b/vcblog/archive/2015/03/03/introducing-the-universal-crt.aspx?PageIndex=2.

While the article does tell me what I should link towards now, it does not provide instructions how.

My Solution generates a .exe and a .dll it uses. I do not know what to do with the matrix the article describes below.

Release DLLs (/MD ): msvcrt.lib vcruntime.lib ucrt.lib

Release Static (/MT ): libcmt.lib libvcruntime.lib libucrt.lib


Solution

  • When you convert your project, you need to make sure you update both the includes AND the linker settings to point to the new CRT.

    For includes, add the following:

    $(UniversalCRT_IncludePath)
    

    For link, add one of the following depending on your target processor:

    $(UniversalCRT_LibraryPath_x86)
    $(UniversalCRT_LibraryPath_x64)
    $(UniversalCRT_LibraryPath_arm)