Visual Studio 2012 Static/DLL Library Problem
-
I have a Qt application which was developed in Linux that I am porting to Windows. I have a couple of my own libraries which I hope to statically link in addition to some of my own Qt libraries which by default are compiled with /MD (dll) via a qmake created Makefile.
I am getting wrapped around the axel with linker errors complaining that I am mixing LIBCMT.LIB and MSVCRT.LIB.
Can anyone offer guidance on how I should use /MD versus /MT compiler flags? I know these are supposed to be linker flags but they appear to have some meaining when building libraries. Perhaps even objects - don't know.
Thanks.
-
Hi,
The short version is: don't mix them. These are the settings to link against the static or dynamic runtime. So all your libraries/application etc… must use the same flag.
You can create a static lib using the dynamic runtime, nothing wrong with that.
By default Qt uses the dynamic runtime
Hope it helps
-
Thanks for the useful reply. I am working with corporate supplied statically linked libraries which were created with the /MTd flag. My only work-around when integrating these libraries is to use the .dll version.
Can you explain what you mean by:
"create static lib using the dynamic runtime"
Thanks again.
-
Just that you can build a static library that uses the Microsoft dynamic runtime.
So your library itself will be static but linked to the dynamic runtime.