检测到“vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker"不匹配:值“1"与 msvcrtd.lib 中的值“0"不匹配 [英] mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker': value '1' doesn't match value '0' in msvcrtd.lib

查看:30
本文介绍了检测到“vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker"不匹配:值“1"与 msvcrtd.lib 中的值“0"不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于 UWP 的 C 库项目.有一些C文件正在调用CPP文件中定义的C++ WINRT函数.它正在编译成功并生成一个库文件(LIB).我正在使用更新 1 在 Visual Studio 2015 中进行编译,目标平台为 10.0.10240.0

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

但是,我想生成 DLL 而不是 LIB 文件.这是我为更改项目所做的更改,以便它生成 DLL 而不是 LIB.

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.

尝试1:因此,在启动项目中,在配置属性 => 常规中,我将配置从静态库更改为动态库.

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

并且在所有项目中,我从多线程调试(/MTd)更改为多线程调试DLL(/MDd).

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

尝试2:创建了一个新项目 Windows 通用项目,并将创建 LIB 的项目中的所有文件添加到该项目中.尽管如此,我还是收到了以下错误.

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.

现在,我收到错误

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.

推荐答案

我遇到了同样的问题并使用链接器标志修复了它:

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

这篇关于检测到“vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker"不匹配:值“1"与 msvcrtd.lib 中的值“0"不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆