我正在将 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.
当您静态将项目与库(通常是具有 .lib 扩展名的文件)链接但链接器使用链接器时,可能会发生此错误Visual Studio 项目中的设置设置为动态链接(意味着链接将在运行时发生,通常使用 .dll 文件).
This error can occur when you are statically linking your project with a library (typically a file with .lib extension) but the linker setting in your Visual Studio project are set to dynamically link (meaning the link will occur during runtime, usually with a .dll file).
要定义您需要项目使用静态链接,请启动 Visual Studio.在解决方案资源管理器窗格中,右键单击项目名称,然后选择属性.展开如下图所示的属性:C/C++ --> Code Generation --> Runtime Library,从里面选择Multi-threaded (/MT)
选项下拉式菜单.
To define that you need the project to use static linking start Visual Studio. In the Solution Explorer pane, right click the project name, and select Properties. Expand the properties as shown in the figure below: C/C++ --> Code Generation --> Runtime Library, select the Multi-threaded (/MT)
option from the dropdown menu.
这篇关于LNK2038:检测到“RuntimeLibrary"不匹配:值“MT_StaticRelease"与 file.obj 中的值“MD_DynamicRelease"不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!