Privacy policyContactsAbout siteOpinionsGitHubDonate
© EVILEG 2015-2018
Recommend hosting

Qt WinAPI - Lesson 003. How to use windeployqt for collect all DLL?

windows, windeployqt, DLL, WinAPI, Qt

In one of the lessons of the Qt it has already been shown how to collect all the DLL, used in the project for the training program for use on other PCs running Microsoft Windows, and now propose to get acquainted with the utility that comes with Qt. This utility is called windeployqt and is a console application, which usually comes bundled with compiler MinGW or MSVC .

To use windeployqt must run from the console, passing as an argument the path to the compiled executable file. Then windeployqt gather all the necessary libraries in the folder where the executable file is located.

The windeployqt utility located in the bin folder, which in turn is located in the folder of the compiler for Qt. Thus, the path to the folder can be as follows:

  • MinGW - C:\QT\5.5\mingw492_32\bin\windeployqt.exe
  • MSVC - C:\QT\5.5\msvc2013\bin\windeployqt.exe

Work with windeployqt

Now get to work with windeployqt . Let's say you already have a compiled executable file and you need to collect all the required DLL for his work. To do this, we'll do a little preparation and perekinem executable file in the folder prepared for collection. I use to demonstrate EColor project, which is written using MinGW . The executable project file will be placed in the following path D:\EColor\EColor.exe.

After that, it will be necessary to open the console (cmd), and go to the console in a folder with windeployqt . Then run the utility by passing its path or file location, as shown in the following figure.

Then the utility will collect all the necessary work for the executable file DLL. And it will look as follows.

Possible mistakes

Also worth noting is that not everything can go smoothly. For example, windeployqt, can not find the library gcc compiler and give the following error:

Cannot find GCC installation directory. g++.exe must be in the system path.

It is fixed with the prescription in the path environment variable to the bin folder, which contains the GCC and the appropriate library.

To do this, go to the following direction (example for OS Windows 7 ):

Control Panel / System / Advanced System Settings / Environment Variables

Then add in the PATH system variables, which are prescribed path to GCC and its libraries. In my case it looks like this:

  • Variable name: PATH
  • Variable value: D:\AndroidQT\QT\5.5\mingw492_32\bin;D:\AndroidQT\QT\Tools\mingw492_32\bin;%PATH%

Then I recommend to restart the PC. After that, the error must be an abyss, and the corresponding library will have to catch up in the folder with the executable file.

The files that can not be collected windeployqt

Also, some files can not be collected via windeployqt , that should also take into account and test the application on another PC before release.

For example, during collecting DLL for EColor, windeployqt still missed the following files:

  • LIBEAY32.dll
  • MSVCP90.dll
  • MSVCR90.dll
  • MSVCR120.dll
  • ssleay32.dll

If the project using QML

UPD 19.11.2018 by alex_lip :

If the project uses QML, then you need to add a special directive --qmldir

This directive will have to specify where to get the source of QML.

windeployqt --qmldir f:\myApp\sources f:\build-myApp\myApp.exe


10% refund of hotel reservation amount on Booking
10% refund of hotel reservation amount on Booking
We offer a link with a 10% return on the amount of the order when booking a hotel through Booking

Добавьте в статью, что если используется Qml следует делать так -

For windeployqt there is the option --qmldir .

windeployqt --qmldir f:\myApp\sources f:\build-myApp\myApp.exe

Спасибо, добавил


Only authorized users can post comments.
Please, Log in or Sign up
March 18, 2019, 3:12 p.m.
Пётр Махнёв

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:50points,
  • Rating points-4
March 18, 2019, 7:59 a.m.
Ян Греку

C++ - Тест 003. Условия и циклы

  • Result:21points,
  • Rating points-10
March 15, 2019, 4:32 p.m.
Михаил Дементьев

C++ - Test 001. The first program and data types

  • Result:60points,
  • Rating points-1
Last comments
March 16, 2019, 1:55 p.m.

Спасибо за статью. Давно итересует следующий вопрос: с помощью переменных QMAKE_TARGET_COMPANYQMAKE_TARGET_PRODUCTQMAKE_TARGET_DESCRIPTIONможно задать свойства компилируемой программы, о...
March 12, 2019, 10:19 a.m.
Jean Stefanovich

Большое спасибо за разъяснения!
March 12, 2019, 10:04 a.m.
Евгений Легоцкой

Hello, In fact, this functionality or is not implemented, or is not documented. I'm not sure. But I think, that it should be implemented in Text QML Type. Because of we can write text in...
March 12, 2019, 9:51 a.m.
Евгений Легоцкой

Да вы правы. На самом деле проще через QSqlQueryModel, сколько не пытался использовать эти дженерики типо QSqlTableModel и QSqlRelationalTableModel, то всегда упирался в какие-то их ограничени...
March 12, 2019, 9:47 a.m.
Jean Stefanovich

Единицы измерения лежат там же где и названия продуктов. Просто в таблице ингредиенты нет ещё одного столбца, на который можно было бы установить setRelation. Я в итоге в базе создал ещё один ...
Now discuss on the forum
March 17, 2019, 10:47 p.m.
Евгений Легоцкой

Добрый день. Вот, нашлось у меня немного времени. Делается это через шаблон проектирования наблюдатель.
March 15, 2019, 9:52 p.m.
Чарльз Грин

спасибо, попробую, отпишусь
March 15, 2019, 7:41 p.m.

Сори догадался)
March 12, 2019, 4:57 p.m.

Большооооое спасибо!!!!!Не передать как я вам благодарен, спасибо что всегда отзываетесь.Теперь я смогу продолжить работу в QT!!! (пробую писать бота (Я как вы могли догадаться немного не пр...
March 12, 2019, 1:20 p.m.

Ну так если у вас есть готовая программа так ей и воспользуйтесь. Вы же написали ее вот и пользуйтесь.
Join us in social networks

For registered users on the site there is a minimum amount of advertising