memcmp链接器错误Visual Studio 2015 [英] memcmp linker error Visual Studio 2015
问题描述
我有一个Visual Studio 2012 c ++项目. 我最近卸载了它并安装了Visual Studio 2015并升级了该项目. 当我构建项目时,出现如下所示的错误:
I have a visual studio 2012 c++ project. I recently uninstalled it and installed visual studio 2015 and upgraded the project. When i am building the project, getting error as shown below:
函数中引用的错误LNK2019无法解析的外部符号_memcmp
Error LNK2019 unresolved external symbol _memcmp referenced in function
此外,我在代码memcmp功能中没有使用任何地方.
Moreover i have not used anywhere in my code memcmp fucntion.
我使用了链接程序的详细功能,可以在输出文件中看到以下内容:
I used the linker verbose function and could see below in output file:
找到了_memcmp
Found _memcmp
在MyC ++ Project.obj中引用
Referenced in MyC++Project.obj
在libcpmtd.lib(xstrcoll.obj)中引用
Referenced in libcpmtd.lib(xstrcoll.obj)
已加载libvcruntimed.lib(__ memcmp_.obj)
Loaded libvcruntimed.lib(__memcmp_.obj)
这里有两个问题
1.即使我没有在代码中使用memcmp,为什么仍然出现该链接器错误?
1.even though i have not used memcmp in my code why i am getting that linker error?
2.为什么将memcmp加载为__memcmp_.obj
2.why is memcmp being loaded as __memcmp_.obj
我的项目中也有以下设置:
I have the following settings also in my project:
1.C ++->代码生成->运行时库设置为/MTd
1.C++-->Code generation-->Runtime Library is set to /MTd
2.Linker->忽略所有默认库都设置为空
2.Linker-->Ignore All default libraries is set to nothing
我尝试了所有项目设置,但徒劳无功.
I have tried all the project settings but everything in vain.
我只有这个我没有使用过的memcmp函数有问题.
I have issue only with this memcmp function which i have not used.
我使用过mamcpy和memset,但没有问题
I have used mamcpy and memset and do not have issue with those
推荐答案
Explicitly add vcruntime.lib or other appropriate version of CRT Library to linker parameters (additional dependencies).
当您显式使用memcmp时,它可能会作为内部函数并被编译为内联函数.
When you use memcmp explicitly it is probably handled as intrinsic function and is compiled as inline function.
这篇关于memcmp链接器错误Visual Studio 2015的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!