Building Qt 5.12.3 on Windows 10 with Visual Studio 2017

The Qt Company has released a new Long Term Support (LTS) version of the Qt framework and I think I should also update the version for my projects; thus: Time for a new post!

And since the last entry in this series, I’ve also finally switched to Windows 10 (currently at version 1803 on my main machine).
(Which reminds me: Despite the last post’s title and text, I already built that previous version (5.9.1) under Windows 10 some time later.)

My IDE has been updated to Visual Studio Community Edition 2017 (Version 15.9.12); but I’ve not yet switched to the recently released VS 2019 (Version 16.x).

As mentioned before, building Qt from source by yourself may not be neccessary when you run up-to-date versions of the OS and IDE: Just install it via the online installer from the Qt site. I do this mostly out of habit and to keep in training 😉

Anyways, if you’re still with me, I guess you also know what/why you want [it]; so, on with the show.

  1. Microsoft Visual Studio 2017 (Community Edition) — install it at least with the C++ Desktop workload, the C++ toolset and the Windows SDK.
  2. Perl/ActivePerl — it should be put in PATH for the command prompt build environment after installation.
  3. Python — it should be put in PATH for the command prompt build environment after installation.

Official page: Qt 5 for Windows - Requirements: Building from Source.


The shortcut to version Qt LTS 5.12.3 is (ca. 800 MByte).

The way to get to the download links for the offline sources is not so obvious, so here are some directions to the main download page, for future versions:
Qt homepage
Download button (page’s upper right corner)
Go Open Source (button in the right column)
Install Qt
→ Down below, near the page’s bottom: “[…] if you are looking for offline packages you can get them here.”
→ Section Source packages & Other releases: “The source code is available: For Windows users a single zip file…”.


Extract it to an appropriate place for you (e.g. I use C:\devel\ext\Qt\5.12.3\ in my environment).
If your extraction tool of choice puts it into sub-directories like qt-everywhere-opensource-src-5.12.3, then move the content of it up to the root level and delete this now empty folder(s).


The next steps describe how you build 64-bit DLLs with Visual Studio 2017; for 32-bit files, or static libraries, or…, adjust the paths/names/options accordingly to your needs!

  1. Open the x64 Native Tools Command Prompt for VS 2017 (you can find it in the start menu entry ‘Visual Studio 2017’) and navigate to C:\devel\ext\Qt\5.12.3\ (or whatever your chosen location is…).

  2. Run Qt’s configure.bat from there to prepare the build.

    Note that the following list of options is a setup that works for me, for my current projects; you may need different features enabled/disabled, etc.
    Run configure -h to get the full list of options.

    Argument Comment
    -confirm-license Automatically acknowledge the license.
    -prefix <DIR> The deployment directory, as seen on the target device.
    <DIR> is a full path like C:\devel\ext\Qt\5.12.3\_64DLL
    -release Release-only build (Build Qt with debugging turned off).
    -opensource Build the Open-Source Edition of Qt.
    -shared Build shared Qt libraries (creating DLLs).
    -platform win32-msvc2017 Use Microsoft Visual C++ 2017.
    -mp Use multiple processors for compilation (Microsoft Visual C++ only).
    -make tools For lupdate/linguist/lrelease and so on.
    -nomake examples Exclude examples.
    -nomake tests Exclude tests.
    -no-icu Do not build the library for Unicode and Globalization support. This would be required for building Qt WebKit.
    But Qt also supports Unicode by default and ICU seems to be on the way out for Qt’s future…
    -no-opengl Do not build OpenGL.
    -no-angle Do not build ANGLE (would translate OpenGL calls into DirectX calls).
    -no-openssl Do not use OpenSSL support.

    That means, you’ll execute a long command, like:

    C:\devel\ext\Qt\5.12.3\> configure.bat -confirm-license -prefix C:\devel\ext\Qt\5.12.3\_64DLL -release ...


  3. Type nmake to kick-off the building process; this will take quite a while (on my current, not very modern setup: hours…)
    To clean up (e.g. after a failed build, before trying again), do nmake distclean.

  4. Type nmake install to move the built binaries to the target directory.

That’s it!