Qt for Windows - Building from Source

This page describes the process of configuring and building Qt for Windows. To download and install a pre-built Qt for Windows, follow the instructions on the Getting Started with Qt page.

Step 1: Getting the Sources

Qt sources can be installed in the Qt Online Installer. Source packages are also available as Git repositories, as archives in the Qt Account (commercial users), and on download.qt.io (open-source users).

If you install the sources through the Qt Online Installer, they will be available in the Qt installation directory, for instance C:\Qt\6.0.1\Src.

If you downloaded the source archive, extract it to a directory of your choice, for instance C:\dev\Qt\src.

Note: The path to the source directory must not contain any spaces or Windows specific file system characters. The path should also be kept short. This avoids issues with too long file paths in the compilation phase.

Step 2: Install Build Requirements

To build Qt from sources you need a build environment with a supported compiler and various build tools available:

Build Tools

  • CMake (available in the Qt online installer)
  • Ninja (available in the Qt online installer)
  • ActivePerl - Install a recent version of ActivePerl (download page).
  • Python - Install Python from the here.

The executables cmake.exe, ninja.exe, perl.exe, and python.exe must be available in your build environment. You achieve this by adding the respective directory to your PATH environment variable.

Note: Please make sure that the perl executable from ActivePerl is found in the path before a potential perl executable provided by msysgit, since the latter is outdated.


The following compilers and configurations are supported in Qt 6.0:

Operating SystemArchitectureCompiler
Windows 10x86_64MSVC 2019, MinGW 8.1

QDoc Dependencies

QDoc uses Clang to parse C++ code. If you wish to build QDoc manually, refer to Installing Clang for QDoc for specific build requirements.

Step 3: Set the Environment Variables

We recommend creating a desktop link that opens a command prompt with the environment set up similar to the Command Prompt menu entries provided by Visual Studio. This is done by creating an application link passing a .cmd file setting up the environment and the command line option /k (remain open) to cmd.exe.

Assuming the file is called qt6vars.cmd and the Qt folder is called C:\Qt\6.0.1\Src:

REM Set up Microsoft Visual Studio 2019, where <arch> is amd64, x86, etc.
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat" <arch>
SET _ROOT=C:\Qt\6.0.1\Src
SET PATH=%_ROOT%\qtbase\bin;%PATH%

A desktop link can then be created by specifying the command %SystemRoot%\system32\cmd.exe /E:ON /V:ON /k C:\Qt\qt6vars.cmd as application.

Depending on your individual setup, you might also need to make the installation directories of CMake, ninja, Perl, and Python part of the SET %PATH% line above.

Note: Setups for MinGW are similar; they differ only in that the bin folder of the installation should be added to the path instead of calling the Visual Studio setup script. For MinGW, please make sure that no sh.exe can be found in the path, as it affects mingw32-make.

Step 4: Build the Qt Library

To configure the Qt library for your machine type, run the configure.bat script in the source directory.

By default, Qt is configured for installation in the C:\Program Files\Qt directory, but this can be changed by using the -prefix option.

The Configure Options page contains more information about the configure options. See Qt for Windows - Graphics Acceleration for specific options regarding graphics acceleration.

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.