Building static Qt on Windows

From QtCentreWiki

Jump to:navigation, search

Building a static version of Qt is not enough to produce a fully standalone executable. The following steps must be done in order to kill dependencies to any external DLLs.


  • Configure
> configure -static -release -no-exceptions
  • Build
> mingw32-make sub-src

Visual Studio

  • Configure
> configure -static -release
  • Build
> nmake sub-src

Qt Command Prompt

Provided that you've got another version of Qt that was installed from a binary installer, you can make a copies of

  • Qt Command Prompt -link in Start Menu
  • <QTDIR>\bin\qtvars.bat

and edit them to point to the static version. This makes it straightforward to switch between dynamic and static Qt.

Qt Creator users and Qt >= 4.6

To add an entry for your static Qt installation in Qt Creator's Qt Version Management System, a static qmake needs to be built by configure.

  • Edit <QTDIR>\qmake\Makefile.win32* files:
to (add -static-libgcc)
LFLAGS = -static-libgcc
  • Continue with MinGW or Visual Studio instructions, whichever applies

See also

jpn 22:14, 17 July 2006 (CEST)