Qt for Windows - Building from Source
Qt sources can be installed in 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 Qt Online Installer, they will be available in the Qt installation directory, for instance
If you downloaded the source archive, extract it to a directory of your choice, for instance
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.
To build Qt from sources you need a build environment with a supported compiler and various build tools available:
|CMake||Version 3.16 and newer (3.17 and newer for ||Required for configuring the Qt build. Available in Qt Online Installer and on cmake.org.|
|Ninja||-||Recommended tool for building Qt. Available in Qt Online Installer and on ninja-build.org.|
|Python||Version 3||Required build tool. Windows installers are available on python.org, or from the Microsoft Store.|
python.exe must be available in your build environment. You achieve this by adding the respective directory to your
PATH environment variable.
The following compilers and configurations are supported in Qt 6.5:
|Windows 10 (1809 or later)||MSVC 2022, MSVC 2019, MinGW 11.2|
|Windows 11||MSVC 2022, MSVC 2019, MinGW 11.2|
|Windows on ARM||MSVC 2019/2022||Technology Preview|
Note: Windows on ARM is only supported as a deployment target. Applications have to be cross-compiled from an x86-64 Windows machine and deployed to target.
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
Assuming the file is called
qt6vars.cmd and the Qt folder is called
REM Set up compiler, in this case Visual Studio Professional 2022 for amd64 CPU's CALL "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64 SET _ROOT=C:\Qt\6.5.4\Src SET PATH=%_ROOT%;%PATH% SET _ROOT=
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, 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
To configure the Qt library for your machine type, create a build directory and change to this directory. Then call the
configure.bat script. Alternatively, if you have already completed Step 3, you may double-click on the desktop link you created, change to the build directory, type
configure and start configuring the Qt library.
Note: Add the Qt build directory to the list of excluded directories of any anti-virus application that runs on your system.
mkdir qt6-build cd qt6-build C:\Qt\6.5.4\Src\configure.bat cmake --build . cmake --install .
By default, Qt is configured for installation in the
C:\Program Files\Qt directory, but this can be changed by using the
© 2023 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.