locked
Cryptic link error after upgrading project to Windows 8.1

    Question

  • vccorlibd.lib(compiler.obj) : error LNK2038: mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker': value '1' doesn't match value '0' in MSVCRTD.lib(appinit.obj)
    vccorlibd.lib(compiler.obj) : error LNK2005: ___crtWinrtInitType already defined in MSVCRTD.lib(appinit.obj)

    It's an app in C++, with 4 static libraries. Compiled in Debug, Win32
    After upgrading to Windows 8.1
    Using Visual Studio 2013 RTM

    Wednesday, October 23, 2013 3:42 AM

Answers

  • OK it is fixed.

    You can't have .C file in a Windows Store App Project. I had to move my C file to a static libraries and make a reference to it.

    • Edited by execom_rt Thursday, October 24, 2013 5:58 AM
    • Marked as answer by execom_rt Thursday, October 24, 2013 5:58 AM
    Wednesday, October 23, 2013 6:29 AM

All replies

  • Are all the static libraries built with VS 2013?
    Wednesday, October 23, 2013 5:40 AM
  • OK it is fixed.

    You can't have .C file in a Windows Store App Project. I had to move my C file to a static libraries and make a reference to it.

    • Edited by execom_rt Thursday, October 24, 2013 5:58 AM
    • Marked as answer by execom_rt Thursday, October 24, 2013 5:58 AM
    Wednesday, October 23, 2013 6:29 AM
  • You can't have .C file in a Windows Store App Project. I had to move my C file to a static libraries and make a reference to it.

    Wait, what!? Can I get a confirmation on this?

    My project also has a bunch of .C files and it fails to compile. It works just fine with Windows 8.0 target (VS2012).

    Friday, November 01, 2013 10:01 AM
  • You can use .c modules in your application subject to the usual API restrictions, but you can't use WinRT APIs from C...

    Make sure that all your libraries are built with the VS 2013 toolset.

    Sunday, November 03, 2013 12:01 AM
  • Howdy,

    For what it's worth, I've seen similar build errors when upgrading app projects from Windows 8.0 to 8.1, and was able to work-around them by adding the following to the app projects' linker flags:

    For Release builds: /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib

    For Debug builds: /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib

    The app projects did use C code, but didn't make WinRT calls directly from those files.  All of those calls were placed in separate C++ files.

    Cheers,

    -- David L.

    Thursday, December 04, 2014 2:43 AM