Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LNK2038: mismatch detected for 'RuntimeLibrary' with cuda

Tags:

c++

cuda

cmake

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

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".

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

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.

Thank you for any suggestion!

like image 837
A. Tuzko Avatar asked Sep 08 '25 08:09

A. Tuzko


1 Answers

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

like image 109
Cherkesgiller Avatar answered Sep 09 '25 23:09

Cherkesgiller