Revisiting Qt (Again): Compiling Qt in Windows

Last time when I compile Qt, I really thought that it would be the last time. No, it isn’t.

A user reported that Penguin Subtitle Player cannot be used under a 32-bit OS. Of course! I compiled it in a 64-bit environment. Time to compile Qt (statically) again in Windows!


  1. Install the required tools: Python 2, ActivePerl, Visual C++ Build Tools 2015
  2. Get the Qt source and decompress it
    • Pro tip 1: Don’t use Windows built-in decompression utility because it is horribly slow. Use a proper tool like 7-Zip.
    • Pro tip 2: Make sure the full path of the Qt source directory doesn’t contain spaces. It may give you weird errors. (So if you decompress into user’s Documents folder and your user name has space in it, you’ll probably fail)
  3. To get a fully static Qt build, i.e. without dynamic linking to some dlls like MSVCP120.dll, you’ll need to do some modification. You can avoid errors like “MSVCP120.dll is missing from your computer.” in user’s computer. We need to modify qtbase/mkspecs/win32-msvc/qmake.conf which points us to qtbase/mkspecs/common/msvc-desktop.conf. Change all MD in QMAKE_CFLAGS_RELEASE, QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO, QMAKE_CFLAGS_DEBUG to MT. i.e. from

    QMAKE_CFLAGS_DEBUG      = -Zi -MDd


    QMAKE_CFLAGS_DEBUG      = -Zi -MTd

    Special thanks to this SO thread!

  4. Start “Visual C++ 2015 x86 Native Build Tools Command Prompt” (“VS2015 x86 Native Tools Command Prompt” also works) (so that the nmake command is available)

  5. Change directory to the root of Qt source and run:

    configure.bat -platform win32 -static -nomake examples -nomake tests -opensource

    You may also skip some useless modules to save time and avoid errors (I got an error for the speech module) according to this GitHub issue: -skip webengine -skip speech -skip scxml -skip charts -skip datavis3d -skip virtualkeyboard

  6. Use jom for faster build. I use jom -j 16 so that each core in my 8-core processor has 2 jobs to run.

  7. Take a nap and wait for hours

Useful resources:

Tags// , , ,