LNK2038:检测到"RuntimeLibrary"不匹配:值"MT_StaticRelease"与file.obj中的值"MD_DynamicRelease"不匹配 [英] LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj
问题描述
我正在将Matlab
,C
和Cuda
集成到一个项目中.我使用Matlab mix来将用c编写的matlab mx函数与cuda运行时库连接,出现链接错误,该错误是由于c文件和库之间的静态发行版和动态发行版中的冲突而引起的.谁能解决这个问题?
I am Integrating Matlab
, C
and Cuda
together in a project. I used Matlab mix in order to connect matlab mx function written in c with the cuda runtime library, a linking error appear about conflict in static release and dynamic release between the c file and the library. Can anyone solve this?
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj.
推荐答案
对于C运行时库,该库和您的项目必须使用相同的设置进行链接.
The library and your project must be linked with the same settings with regards to the C Runtime Library.
在您的情况下,一个链接到CRT DLL(/MD),另一个链接静态(/MT).
In your case one was linked against the CRT DLL (/MD) and the other was linked statically (/MT).
您只需要确保两者都匹配并且此错误就会消失.
You just need to make sure both match and this error will go away.
这篇关于LNK2038:检测到"RuntimeLibrary"不匹配:值"MT_StaticRelease"与file.obj中的值"MD_DynamicRelease"不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!