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
Дмитрий

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

  • Result:60points,
  • Rating points-1
Дмитрий

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

  • Result:92points,
  • Rating points8
d
  • dsfs
  • April 26, 2024, 1:56 a.m.

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

  • Result:80points,
  • Rating points4
Last comments
k
kmssrFeb. 8, 2024, 3: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, 7: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, 5: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, 6: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
G
George13May 6, 2024, 9:27 p.m.
добавить qlineseries в функции в функции: "GPlotter::addSeries(QString title, QVector &arr)" я вызываю метод setChart(...), я в конструктор передал адрес на QChartView элемент
BlinCT
BlinCTMay 5, 2024, 2:46 a.m.
Написать свой GraphsView Всем привет. В Qt есть давольно старый обьект дял работы с графиками ChartsView и есть в 6.7 новый но очень сырой и со слабым функционалом GraphsView. По этой причине я хочу написать х…
PS
Peter SonMay 3, 2024, 2:57 p.m.
Best Indian Food Restaurant In Cincinnati OH Ready to embark on a gastronomic journey like no other? Join us at App india restaurant and discover why we're renowned as the Best Indian Food Restaurant In Cincinnati OH . Whether y…
Evgenii Legotckoi
Evgenii LegotckoiMay 2, 2024, 11:07 a.m.
Мобильное приложение на C++Qt и бэкенд к нему на Django Rest Framework Добрый день. По моему мнению - да, но то, что будет касаться вызовов к функционалу Андроида, может создать огромные трудности.
IscanderChe
IscanderCheApril 30, 2024, 1:22 a.m.
Во Flask рендер шаблона не передаётся в браузер Доброе утро! Имеется вот такой шаблон: <!doctype html><html> <head> <title>{{ title }}</title> <link rel="stylesheet" href="{{ url_…

Follow us in social networks