Question

priyam1990 on Sun, 05 Mar 2017 15:02:44


i am trying to build a program and it is showing the following error

error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in vrpn-receiver.obj

i have already tried to changed the runtime library settings .i mean i have applied both 'MD_DynamicRelease' and 'MDd_DynamicDebug' in the runtime library settings , but i do not know why its still showing the same error.

by the way i m using visual studio 2013 express edition

can any one please help out of this

thank you 

Replies

RLWA32 on Sun, 05 Mar 2017 15:16:38


i am trying to build a program and it is showing the following error

error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in vrpn-receiver.obj

i have already tried to changed the runtime library settings .i mean i have applied both 'MD_DynamicRelease' and 'MDd_DynamicDebug' in the runtime library settings , but i do not know why its still showing the same error.


I don't understand what the highlighted comment is trying to convey.

If you want to use the DLL version of the CRT for a debug build then the compiler option should be set to /MDd.  If you want a release build then the option should be set to /MD.  See https://msdn.microsoft.com/en-us/library/2kzt1wy3(v=vs.120).aspx

Is vrpn-receiver.obj created by your own code or is it coming from a library (.lib) referenced by the project?


priyam1990 on Mon, 06 Mar 2017 02:57:19


thanks for the reply

through the highlighted comment i just want to say that i have already set the compiler option to both /MDd and /MD,but it is not working for me

and the vrpn-reciever.obj is coming from the library(.lib) referenced by the project 

so i am still stuck with it, can you please help me out of it

thank you

Baron Bi on Mon, 06 Mar 2017 07:26:56


Hi priyam1990,

thanks for posting here.

>>through the highlighted comment i just want to say that i have already set the compiler option to both /MDd and /MD,but it is not working for me

and the vrpn-reciever.obj is coming from the library(.lib) referenced by the project 

What do you mean you have already set the compiler option to both /MDd and /MD? How do you do that?

Code that uses one version of the C++ Standard Library or C runtime is incompatible with code that uses a different version. All modules passed to a given invocation of the linker must have been compiled with the same run-time library compiler option.

So please set your application and the modules it references to the same run-time library compiler option, /MDd or /MD.

Hope this could be help of you.

Best Regards,
Sera Yu

priyam1990 on Mon, 06 Mar 2017 14:12:41


sorry my reply was not clear.....actually i was trying to say that i changed the runtime library settings in properties\c/c++\code generation\runtime library i first used /MDd and then /MD but the issues is not resolved yet

RLWA32 on Mon, 06 Mar 2017 14:17:30


Can you create a demo that reliably reproduces the issue and share it on onedrive?  This should  include the project that builds the library containing vrpn-receiver.obj.

Baron Bi on Tue, 07 Mar 2017 02:02:53


Hi priyam1990,

>>sorry my reply was not clear.....actually i was trying to say that i changed the runtime library settings in properties\c/c++\code generation\runtime library i first used /MDd and then /MD but the issues is not resolved yet

Did you check the vrpn-receiver file's property to see if its property is same as the whole project's property?

Error LNK2038 means a symbol mismatch has been detected by the linker. This error indicates that different parts of an app—this includes libraries or other object code that the app links to—use conflicting definitions of the symbol. You could use detect mismatch pragma to detect their conflicting values.

Hope this could be help of you.

Best Regards,

Sera Yu

JeffAtLanex on Fri, 12 Jun 2020 22:44:30


Solution for me was to recompile static library(opencv) with matching Configuration/C/C++/All Options/Runtime Library settings between EXE and externally compiled, static library.  My EXE is set to /MT(d) and needed to re-compile static library to match; for OpenCV make sure to update all projects, there maybe easier way when generating solution with CMAKE).