How To Deploy a QT Application on Windows

How To Deploy a QT Application on Windows: The windeployqt Windows deployment tool is designed to automate the process of creating a deployable folder that contains the Qt-related dependencies (libraries, QML imports, plugins, and translations) necessary to run the application from that folder. It produces a Windows Runtime sandbox or a Windows desktop setup tree that can readily be bundled into an installation package.

Windeployqt requires a.exe file or folder as an argument that includes a.exe file and scans the dependency executable. If the —qmldir argument passes a folder, windeployqt utilizes the qmlimportscanner tool to scan QML documents for QML import dependencies inside the folder. Identified dependencies are then copied to the folder of the executable. In addition, the local hardcoded routes in Qt5Core.dll are substituted by relative routes.

Steps : How To Deploy a QT Application on Windows :

Requirement:

A project in Qt with No compile/Runtime error.

1- First of all You need to Build Your Project in Release mode. In my case, it is found in C:\Users\risha\Documents\lyricpad-master

How To Deploy a QT Application on Windows Screenshot-96

Note: If You are having any Error related to SSL :

How To Deploy a QT Application on Windows: If you have used QNetworkAccessManager class in your project then You could encounter with an error-“TLS initialization failed: “. Visit this above link to overcome this problem.

2- Go to the build directory of your project. In my case it is found in:

"C:\Users\risha\Documents\lyricpad-master\build-lyricspad-Desktop_Qt_5_12_3_MinGW_32_bit-Release\release"
How To Deploy a QT Application on Windows ss_97

If you run your application.exe inside Release directory then you probably met with Error: QT5 gui.dll is missing and some other .dll’s etc. as shown in the pictures below:

How To Deploy a QT Application
error_2
error_3
error_4

That means you have to bring the Dlls library of Qt5 in order to make your application run on windows. You can paste All the required .dlls inside release directory. Sounds Cool! hmmm ‘No’. Okay, No problem we got your Back! Proceed Step 3 then.

3- How To Deploy a QT Application on Windows: Once you are done with a sucessfull compilation of your project and have to build your project as in release mode, then Check your Build setting in “Projects” Option on the left of QT creator.

build setting of How To Deploy a QT Application on Windows

4- If You build your application using “MinGW_32/64 bit compiler“, then open start menu of your windows, and type mingw, and open it as an admin. For eg it will be inside C:\Qt\5.12.3\mingw73_32>

mingw How To Deploy a QT Application on Windows

OR

If You build your application using “MSVC 64/32 bit compiler“, then open start menu of your windows, and type “MSVC”, and open it as an admin. For eg it will be inside C:\Qt\5.12.3\msvc2017_64>

msvc

In my case, it is MinGW compiler, But don’t worry if you have Msvc Build then steps are same as it is for the MinGW build.

5- Now Type windeployqt.exe inside the directory C:\Qt\5.12.3\mingw73_32. Please see screenshot below:

windeployqt How To Deploy a QT Application on Windows

6- Now navigate and open your build directory by typing the following command given below.

cd C:\Users\risha\Documents\lyricpad-master\build-lyricspad-Desktop_Qt_5_12_3_MinGW_32_bit-Release\release
go to the path

7- Now type windeployqt.exe –quick .

Note: Donot forget “.” after quick

run cmd

8- Now you will see inside your release directory:

C:\Users\risha\Documents\lyricpad-master\build-lyricspad-Desktop_Qt_5_12_3_MinGW_32_bit-Release\release 

All the files and dlls which are required to run your QT application are there inside the release directory.

How To Deploy a QT Application on Windows

Now Open Your application.exe inside your release directory. In my case it is lyricpad.exe

That’s all! Congrats You have made it a real application which can be shared to the people. That is How To Deploy a QT Application on Windows.

If you have any query/problem in this tutorial, then feel free to comment below, we will reply your query within 2 hrs. THANKYOU!!