LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj

Ahmed Hassan picture Ahmed Hassan · Mar 5, 2015 · Viewed 86.7k times · Source

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. 

Answer

tux3 picture tux3 · Mar 5, 2015

The library and your project must be linked with the same settings with regards to the C Runtime Library.

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.