Solved Qt-MSVC Project: How to use dynamic library and other third-party static lib in same proect
-
In my Qt-MSVC project, used many different libraries, some supply to me as a dynamic library, and other static libraries, and when I build the project: mismatch appears.
I don't have the libraries' codes, so I couldn't rebuild. What can I do in this case?
libxxx.lib(common.obj):-1: error: LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MDd_DynamicDebug' in Helper.obj
-
Hi @Bruce-Zhang,
I don't think there's much we can help here. You not only have libraries requesting different C++ runtime libraries (MT vs. MD), but also release vs. debug versions (the small 'd').
If you cannot compile the libs yourself, you'll have to request them from the respective vendors.
Regards
-
@aha_1980
Thanks for the reply, is it possible for dynamic lib and static lib with the same configuration of debug mode /release mode? -
@Bruce-Zhang
While you await a better answer. I would say, I do not think so for your MSVC case. There is not much about this out there on the web. I agree with https://stackoverflow.com/a/2285450/489865, and the second comment there. You are trying to mix MSVC compiled with options/MT
and/MD
. Being C/C++, these use static & dynamic C runtime libraries respectively. I do not believe these will mix/work correctly: for example, they won't agree/use the same global variables in the C runtime.Having said that, I stand to be corrected, and it is certainly worth a test. Can you obtain a non-debug version of your dynamic library, i.e. compiled
/MD
instead of/MDd
? -
Thanks, @JonB , I'll have a try, and respond later.