How to Build Qt 5.7 Statically Using MSVC14 (Microsoft Visual Studio 2015)

Posted on Posted in Qt Tutorials, Tutorials

In this post I will describe how to build Qt 5.7 statically for Windows using MSVC 14 compiler or in other words Microsoft Visual C++ 2015 which is included in Microsoft Visual Studio 2015. Quite obviously you need to install Microsoft Visual Studio 2015 (Community edition is free) before continuing with this guide. You can find it here:

Next, you need to download the latest sources (in this case 5.7.0) of Qt from here:

Create a folder named Static under default Qt installation.


Copy downloaded Qt archive to this folder and extract it there. So you will have a folder containing all Qt sources here:


Now go to C:\Qt\Static\qt-everywhere-opensource-src-5.7.0\qtbase\mkspecs\common and change msvc-desktop.conf like this (change all MD to MT to remove dependency on msvc dlls, only in the following lines.)

initial values:


should be changed to:


Now press Start and run “Developer Command Prompt for VS2015” as Administrator.

Change directory using CD command to “C:\Qt\Static\qt-everywhere-opensource-src-5.7.0” where you extracted Qt source code.

Enter the following command to configure your Qt build in static mode. (You can get all configure options here but below is the minimum options I use which includes most widely used stuff.)

configure -static -debug-and-release -prefix “C:\Qt\Static\5.7.0” -platform win32-msvc2015 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -qt-sql-odbc -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests

When configuration is completed, run the following command to start the build process. Go grab a cup of coffee cause it’s going to take some time.


When building is completed, you need to enter one last command to get a ready to use static build kit in “C:\Qt\5.7.0”

nmake install

And it’s done.

To use your new development kit with Qt Creator you need to add it to list of known kits. So open Qt Creator and go to Tools / Options from the main menu.

Then select Build & Run from the list of options and open Qt Versions tab. Then click Add.


Now select the qmake.exe that you just created from “C:\Qt\Static\5.7.0\bin” as seen below:




Next you have to change the kit name as seen in this picture:qt-kit-3

Then change to Kits and press the Add button.qt-kit-4

Now make sure you set all the options as seen in the picture below:




Now if you create a new project you will notice you can use the newly create kit to develop Qt applications that do not require DLLs to be deployed with them.


You’ll also notice that EXE files created using this kit are a little bit bigger than usual and that is because all the code is included in the app instead of DLL files.

Leave a Reply

Your email address will not be published. Required fields are marked *