I want the users to be able to re-link my Qt-using application to their own build of Qt, without being forced to rebuild all of the sources. This could be used for LGPL comp
It turns out that the linker isn't clever enough to figure out what default runtime library is needed for the executable if only static libraries are given to link, with no discrete object files. This can be corroborated by asking the linker to be verbose in the .pro file:
win32-msvc*: QMAKE_LFLAGS += /VERBOSE /VERBOSE:LIB /VERBOSE:REF
When the dummy file is present in the application project, the linker lists the following default libraries:
Processed /DEFAULTLIB:msvcprt
Processed /DEFAULTLIB:MSVCRT
Processed /DEFAULTLIB:OLDNAMES
Processed /DEFAULTLIB:uuid.lib
Without the dummy file, no default libraries are chosen by the linker at all. It is then unable to find the entry point, since the C runtime is not linked in.
Adding the relevant C runtime library is sufficient to link the application. In the application project file, one adds:
win32-msvc*:CONFIG(release, debug|release): QMAKE_LFLAGS += /DEFAULTLIB:msvcrt
win32-msvc*:CONFIG(debug, debug|release): QMAKE_LFLAGS += /DEFAULTLIB:msvcrtd