I compiled qt 5.5.1 statically using the following options:
configure -static -release -platform win32-msvc2013
and now when I am trying to compile a simple hello world program that doesn't use any qt libraries (just plain c++ app).
The problem is that I can't set the linker options for the program to use static msvc libraries using the /MT flag. I am adding this to project file:
CONFIG += static
QMAKE_CFLAGS_RELEASE += -O2 -MT
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
QMAKE_CFLAGS_DEBUG += -Zi -MTd
I get the following error:
msvcprt.lib(locale0_implib.obj):-1: error: LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
and
:-1: warning: LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
I figured it out, the clean command didn't delete the MAKEFILE.RELEASE so I had to go delete the file manually and qmake generated a new file with correct -MT parameter. Thanks for all the help.