I need to build a Qt5 64 bit program which links to static .lib libraries (compiled with /MT). I tried changing the lines below from MD to MT:
QMAKE_CFLAGS_RELEASE = -O2 -MT
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
QMAKE_CFLAGS_DEBUG = -Zi –MTd
in the file D:\Qt\Qt5.0.0src\qtbase\mkspecs\win32-msvc2010\qmake.conf
and recompiling it with
configure -prefix %CD%\qtbase -debug-and-release -opensource -platform win32-msvc2010 -opengl desktop
and then nmaking it, but it failed with:
XPathGrammar.cpp
Generating Code...
lib /NOLOGO /OUT:release\WebCore.lib @C:\Users\Paul\AppData\Local\Temp\WebCore.lib.4480.3319717.jom
LINK : fatal error LNK1181: cannot open input file '.obj\release_shared\SettingsMacros.obj'
jom: D:\Qt\Qt5.0.0src\qtwebkit\Source\WebCore\Makefile.WebCore.Target.Release [release\WebCore.lib] Error 1181
jom: D:\Qt\Qt5.0.0src\qtwebkit\Source\WebCore\Makefile.WebCore.Target [release] Error 2
jom: D:\Qt\Qt5.0.0src\qtwebkit\Source\WebCore\Makefile.WebCore [sub-Target-pri-make_first-ordered] Error 2
jom: D:\Qt\Qt5.0.0src\qtwebkit\Makefile [sub-Source-WebCore-WebCore-pro-make_first-ordered] Error 2
jom: D:\Qt\Qt5.0.0src\Makefile [module-qtwebkit-make_first] Error 2
It seems that the “SettingsMacros.obj” file doesn’t get generated. Why is that?
Do I need to include “-static” in the configure string? I know that Qt doesn’t get along with /MT but my project needs it otherwise I would not be able to link those .lib files
yes, you do need to add
-static. Worked for me.