diff --git a/mkspecs/features/entrypoint.prf b/mkspecs/features/entrypoint.prf index 8442f8930bc..4601455c4a5 100644 --- a/mkspecs/features/entrypoint.prf +++ b/mkspecs/features/entrypoint.prf @@ -1,2 +1,11 @@ -qt:!console:contains(TEMPLATE, ".*app"): \ +qt:!console:contains(TEMPLATE, ".*app") { + # This library needs to come before the entry-point library in the + # linker line, so that the static linker will pick up the WinMain + # symbol from the entry-point library. Unfortunately qmake and the + # module system doesn't allow specifying linker flags or dependencies + # as part of the module that end up _before_ the library itself, so + # we have to work around it by declaring the dependency here. + mingw: LIBS += -lmingw32 + QT_PRIVATE += entrypoint +} diff --git a/src/entrypoint/entrypoint.pro b/src/entrypoint/entrypoint.pro index dd0618cd560..9dc8de57d45 100644 --- a/src/entrypoint/entrypoint.pro +++ b/src/entrypoint/entrypoint.pro @@ -23,7 +23,6 @@ win32 { mingw { DEFINES += QT_NEEDS_QMAIN MODULE_DEFINES += QT_NEEDS_QMAIN - LIBS += -lmingw32 } }