Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker': value '1' doesn't match value '0' in msvcrtd.lib

I have a C library project for UWP. There are some C files which are calling C++ WINRT functions defined in CPP file.It is compiling successfully and generating a library file(LIB). I am compiling in Visual Studio 2015 with update 1 and target platform is 10.0.10240.0

But, I want to generate DLL instead of LIB file. Here's the changes I did to change the project so that it generates DLL instead of LIB.

Try1: So, In the startup project, In Configuration Properties => General I change Configuration from Static Library to Dynamic Library.

And in all the project, I changed from Multi-threaded Debug(/MTd) to Multi-threaded Debug DLL(/MDd).

Try2: Created a new project Windows Universal Project and added the all the files from the project creating LIB to this project. Still, I am getting the below errors.

Now, I am getting the errors

vccorlibd.lib(init.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(app_appinit.obj)
vccorlibd.lib(init.obj) : error LNK2005: __crtWinrtInitType already defined in msvcrtd.lib(app_appinit.obj)
msvcrtd.lib(initializers.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

Any Suggestions how to resolve this.

like image 207
Sushil_Arora Avatar asked Dec 28 '25 16:12

Sushil_Arora


1 Answers

I had the same Issue and fixed it using the linker flags:

/nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib

for debug builds you can use:

/nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib
like image 64
RGPaul Avatar answered Dec 30 '25 04:12

RGPaul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!