Welcome to the public account: FensnoteCopy the code

The article directories

      • Compile the Release version and copy the dependent library files
        • Select Release mode
        • Use the windeployqt.exe command to extract the used DLL library
      • Package using Inno Setup
        • Download and install
        • After the installation is complete, start packing
        • Start compiling and packaging
        • Packaging complete
        • Install the test
      • release

Compile the Release version and copy the dependent library files

Select Release mode

Select the project Release in QtCreater to compile the Release version of the EXE file;

Use the windeployqt.exe command to extract the used DLL library

Open Qt’s Mingw command-line interface:



On the command line, switch to the folder where the EXE file is located and run the following command:

windeployqt lock.exe
Copy the code

This command will copy all library files used by the exe:

E:\qtwork\lock-Release\release>windeployqt lock.exe
E: \qtwork\lock-Release\release\lock.exe 32 bit.release executable
Adding Qt5Svg for qsvgicon.dll
Skipping plugin qtvirtualkeyboardplugin.dll due to disabled dependencies (Qt5Qml Qt5Quick).
Direct dependencies: Qt5Core Qt5Gui Qt5Widgets
All dependencies   : Qt5Core Qt5Gui Qt5Widgets
To be deployed     : Qt5Core Qt5Gui Qt5Svg Qt5Widgets
Updating Qt5Core.dll.
Updating Qt5Gui.dll.
Updating Qt5Svg.dll.
Updating Qt5Widgets.dll.
Updating libGLESV2.dll.
Updating libEGL.dll.
Updating D3Dcompiler_47.dll.
Updating opengl32sw.dll.
Updating libgcc_s_dw21.dll.
Updating libstdc+ + - 6.dll.
Updating libwinpthread1.dll.
Patching Qt5Core.dll.Creating directory E: /qtwork/lock-Release/release/iconengines.
Updating qsvgicon.dll.
Creating directory E: /qtwork/lock-Release/release/imageformats.
Updating qgif.dll.
Updating qicns.dll.
Updating qico.dll.
Updating qjpeg.dll.
Updating qsvg.dll.
Updating qtga.dll.
Updating qtiff.dll.
Updating qwbmp.dll.
Updating qwebp.dll.
Creating directory E: /qtwork/lock-Release/release/platforms.
Updating qwindows.dll.
Creating directory E: /qtwork/lock-Release/release/styles.
Updating qwindowsvistastyle.dll.
Creating E: \qtwork\lock-Release\release\translations.Creating qt_bg.qm.Creating qt_ca.qm.Creating qt_cs.qm.Creating qt_da.qm.Creating qt_de.qm.Creating qt_en.qm.Creating qt_es.qm.Creating qt_fi.qm.Creating qt_fr.qm.Creating qt_gd.qm.Creating qt_he.qm.Creating qt_hu.qm.Creating qt_it.qm.Creating qt_ja.qm.Creating qt_ko.qm.Creating qt_lv.qm.Creating qt_pl.qm.Creating qt_ru.qm.Creating qt_sk.qm.Creating qt_uk.qm.Copy the code

As shown below, the copied file:



Test if it can be run directly, sometimes it may still be incomplete, then follow the prompt which is missing, find which one, fortunately, this can run:



Now you can package the folder.

Package using Inno Setup

Inno Setup is a free software package that can package the executable file (exe) and its dependent DLL library files into an installation file (setup.exe). Please click here to download the official website:jrsoftware.org/isdl.php

Download and install

Download and install will not be introduced in detail here, Windows application installation is basically the same, all the way “next”.

After the installation is complete, start packing

The default is used directly in the middle, and I skip the steps that need not be explained.

Create a package script:



Enter application information, including version, publisher, and website:



Installation directory Settings:



Select files and folders to pack:



Installation language Settings:



Generated installation file configuration:



Then the configuration ends:





The packaging script is now configured and ready to be packaged.

Start compiling and packaging

Follow the steps above:



You will be prompted to save the script:



Compile package:

Packaging complete

When the package is complete, an installation file (EXE) will be generated on the desktop:

Install the test

As with installing Windows, the “next step” along the way:





This icon is missing because this program was compiled without setting the icon. Double-click this icon to run:



It works fine, and now you can release the package and install it on another computer.

Note: versions after Qt5.7 no longer support XP.

release

You can send a packed document to a friend!