LNK2038:检测到与CUDA的"RuntimeLibrary"不匹配 [英] LNK2038: mismatch detected for 'RuntimeLibrary' with cuda

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

问题描述

我正在使用Visual Studio 2013编译包含cpp和cu文件的动态库,并且在链接期间出现此类错误:

I am compiling a dynamic library containing cpp with cu files with Visual Studio 2013, and I get such errors during linking:

proj_generated_cufile.cu.obj : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj
libcpmt.lib(ios.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj

我没有使用任何其他库,并且我已经尝试在项目首选项-> C/C ++->代码生成为多线程DLL(/MD)"和CUDA C/下设置运行时库.C ++->主机到多线程DLL(/MD)"或从主机继承".

I am not using any additional libraries, and I have already tried to set the Runtime Library in the project preferences -> C/C++ -> Code generation to "Multi-Threaded DLL (/MD)" and under CUDA C/C++ -> Host to "Multi-Threaded DLL (/MD)" or to "inherit from host".

我正在使用cmake(使用cuda_add_library)生成项目.

I am generating the project with cmake (with cuda_add_library).

问题可能是我正在尝试编译动态库吗?与该假设相反的是,当我仅编译cpp文件时,编译成功.

Can it be, that the problem is, that I am trying to compile a dynamic library? What contradicts this assumption is that when I am compiling only the cpp files the compilation succeeds.

谢谢您的任何建议!

推荐答案

我认为,一个链接到CRT DLL(/MD),另一个链接静态(/MT).

I think , one was linked against the CRT DLL (/MD) and the other was linked statically (/MT).

这篇关于LNK2038:检测到与CUDA的"RuntimeLibrary"不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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