Deploying a Qt 5 application on Windows

Development with Qt is generally pretty nice: it is a well documented API, and most parts of it are well thought out. However, when the time comes to deploy your program, there is less hand-holding available. If you’re still with the Rebels writing open source software you can probably get away with dumping tarballs of the code in strategic places. If, however, you’ve sided with the Empire of proprietary software for fun & profit, you have to make sure your software is a nice self-contained little executable bundle. A nice starting point is available at With this post I want to supply a few bits of information I felt was missing from that tutorial; let’s see if I succeed.

I am creating a desktop application in C++ and Qt 5 that will be deployed on Windows workstations running XP or 7. The program has no dependencies outside of Qt. In other words, this is pretty much as simple a deployment as you can have, but I still found myself using the better part of a workday researching what files I need to distribute and how to create an installer package.

Qt and its environment

The software is compiled on a computer running Windows XP SP3. It is a clean install, with only Qt 5.1.1 with MinGW 4.8 installed (from the binary distribution available here), and the Nullsoft NSIS 3.0a1 installer creation software (available here). Everything is 32-bit to be compatible with both XP and 7 targets.

As I’m using the open source edition of Qt, the libraries are dynamically linked. The Qt modules I required for this application are Qt Core, Qt Gui, and Qt Widgets.


  • Qt directory: The directory tree created by the Qt installer, with all files necessary for development. This directory will very likely not be present on the target computer. Instead, we will copy a few files from this directory tree and distribute them with our application.
  • Target computer: The computer where your application will be deployed. The installer, that we will create, is executed on this computer.
  • Development computer: The computer where we compile the software, and where the Qt directory is installed.
  • Application directory: This is the directory on the target computer where our executable file, along with a few other necessary files, is located. This directory is created by the installer, usually (but not necessarily) as a subdirectory in C:\Program Files.
  • Installer creator: The program used to bundle together all required file into an executable installer, as opposed to the installer itself, which is the product of the installer creator.

Files to deploy

When you compile the release version of your software in Qt Creator, an executable file will be created in your build directory. The build directory can be configured in Projects (Ctrl-5), in the General section. Of course, this executable will be part of our distribution.

Some or all of the shared libraries on which the executable depends will not necessarily be available on the target computer. We need to distribute them with the executable; conveniently, Windows will search for the required shared libraries in the directory where the executable resides (as well as in several predefined system directories). If you wonder what libraries your application needs, you can use the popular tool Dependency Walker.

In addition to the shared libraries, Qt also requires so-called plugins: these are shared libraries, loaded on demand by Qt rather than automatically by the operating system. In order for Qt to find its plugins, they need to be located in a specific subdirectory (see below).

In my case all the files required for distributions could be found in different locations in the Qt directory. I created a new directory for the purpose, and copied all the files to be distributed there. It would be a good idea to make this automatic, perhaps as part of the build process, but I haven’t done that yet. Here is a list of the files in my distribution:

From C:\Qt\Qt5.1.1\5.1.1\mingw48_32\bin

  • icudt51.dll
  • icuin51.dll
  • icuu51.dll
  • libgcc_s_dw2-1.dll
  • libstdc++-6.dll
  • libwinpthread-1.dll
  • Qt5Core.dll
  • Qt5Gui.dll
  • Qt5Widgets.dll

From C:\Qt\Qt5.1.1\5.1.1\mingw48_32\plugins\

  • platforms\qwindows.dll (create the directory “platforms” in your distribution directory and pop qwindows.dll into it)

And finally, my executable from the release build directory:

  • qtcpm.exe

qtcpm.exe can now be run directly from the dist directory on any Windows XP or Windows 7 machine.

If there is interest, my next post will detail how to create an application icon, and how to create an installer for your software.