Evgenii Legotckoi
Evgenii LegotckoiMarch 7, 2016, 10:52 a.m.

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

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

Video

We recommend hosting TIMEWEB
We recommend hosting TIMEWEB
Stable hosting, on which the social network EVILEG is located. For projects on Django we recommend VDS hosting.

Do you like it? Share on social networks!

alex_lip
  • Nov. 19, 2018, 7:32 a.m.

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


For windeployqt there is the option --qmldir .

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


Evgenii Legotckoi
  • Nov. 19, 2018, 12:53 p.m.

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

А
  • July 9, 2022, 12:32 p.m.
  • (edited)

Тук-тук. Привет из прошлого! Не могли бы вы подробнее расказать о том, куда должна быть записана данная вставка "windeployqt --qmldir f:\myApp\sources f:\build-myApp\myApp.exe"? Я пробовал указать после пути распаковки .dll, но получаю ошибку.

C:\Qt\Qt5.14.2\5.14.2\mingw73_64\bin>windeployqt.exe c:\p\untitled.exe windeployqt --qmldir ...

f:\build-myApp\myApp.exe - это путь к .exe файлку, который я хочу открыть, я так понимаю, а первый что означает (f:\myApp\sources)? Это папка с релизом проекта или это папка с самим проектом (там где .pro-файл)? Заранее спасибо

Comments

Only authorized users can post comments.
Please, Log in or Sign up
B

C++ - Test 002. Constants

  • Result:16points,
  • Rating points-10
B

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

  • Result:46points,
  • Rating points-6
FL

C++ - Test 006. Enumerations

  • Result:80points,
  • Rating points4
Last comments
k
kmssrFeb. 8, 2024, 6:43 p.m.
Qt Linux - Lesson 001. Autorun Qt application under Linux как сделать автозапуск для флэтпака, который не даёт создавать файлы в ~/.config - вот это вопрос ))
Qt WinAPI - Lesson 007. Working with ICMP Ping in Qt Без строки #include <QRegularExpressionValidator> в заголовочном файле не работает валидатор.
EVA
EVADec. 25, 2023, 10:30 a.m.
Boost - static linking in CMake project under Windows Ошибка LNK1104 часто возникает, когда компоновщик не может найти или открыть файл библиотеки. В вашем случае, это файл libboost_locale-vc142-mt-gd-x64-1_74.lib из библиотеки Boost для C+…
J
JonnyJoDec. 25, 2023, 8:38 a.m.
Boost - static linking in CMake project under Windows Сделал всё по-как у вас, но выдаёт ошибку [build] LINK : fatal error LNK1104: не удается открыть файл "libboost_locale-vc142-mt-gd-x64-1_74.lib" Хоть убей, не могу понять в чём дел…
G
GvozdikDec. 18, 2023, 9:01 p.m.
Qt/C++ - Lesson 056. Connecting the Boost library in Qt for MinGW and MSVC compilers Для решения твой проблемы добавь в файл .pro строчку "LIBS += -lws2_32" она решит проблему , лично мне помогло.
Now discuss on the forum
AC
Alexandru CodreanuJan. 19, 2024, 11:57 a.m.
QML Обнулить значения SpinBox Доброго времени суток, не могу разобраться с обнулением значение SpinBox находящего в делегате. import QtQuickimport QtQuick.ControlsWindow { width: 640 height: 480 visible: tr…
BlinCT
BlinCTDec. 27, 2023, 8:57 a.m.
Растягивать Image на парент по высоте Ну и само собою дял включения scrollbar надо чтобы был Flickable. Так что выходит как то так Flickable{ id: root anchors.fill: parent clip: true property url linkFile p…
Дмитрий
ДмитрийJan. 10, 2024, 4:18 a.m.
Qt Creator загружает всю оперативную память Проблема решена. Удалось разобраться с помощью утилиты strace. Запустил ее: strace ./qtcreator Начал выводиться весь лог работы креатора. В один момент он начал считывать фай…
Evgenii Legotckoi
Evgenii LegotckoiDec. 12, 2023, 6:48 a.m.
Побуквенное сравнение двух строк Добрый день. Там случайно не высылается этот сигнал textChanged ещё и при форматировани текста? Если решиать в лоб, то можно просто отключать сигнал/слотовое соединение внутри слота и …

Follow us in social networks