Tangwx

Tangwx

博客网站

Qt Packaging exe

Packaging Qt exe#

Step 1#

How to generate .exe files#

First, change the build mode of the QT Creator editing interface to Release mode and recompile!
image-20231010185324319
Then click Run (ctrl+R)! In the project column, under the build directory, a folder named with "release" will be generated.
image-20231010185527755

It contains the following files:
image-20231010185627211
Open the release folder, which contains the corresponding .exe file!
image-20231010185652994
At this time, clicking on the .exe file will not run successfully because we are still missing the necessary Qt library files.

image-20231010185734592

Step 2#

How to run the generated .exe file on a computer without QT installed#

See below for details: First, place the generated .exe file separately in an empty folder!
image-20231010185911059

Search for Qt in win10 and open the command window in the red box:
image-20231010190017809
Enter the directory where the .exe was just copied
image-20231010190157192

Then enter: windeployqt .exe filename Enter.
image-20231010190258096
image-20231010190342010
At this point, you can see that many files appear in the original empty folder:
image-20231010190356444
At this point, this .exe file can be run on a computer without QT installed!
You need to copy the folder where the .exe file is located to another computer.
You can package this folder and send it to others for testing!

Note: The combination of VS2010 and Qt5.0 plugin can also generate .exe files and can be successfully run on a computer without VS2010 installed.

Step 1#

Change Debug to Release in VS2010, then start debugging (F5), and after successful debugging, the XXX.exe file will be generated in the Release folder under the project folder.

Step 2#

Same as QtCreator software

Step 3#

Same as QtCreator software

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.