Tangwx

Tangwx

博客网站

Qt packaging exe

Packaging Qt into an exe file#

Step 1#

How to generate an .exe file#

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 point, 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#

Specific steps: First, place the generated .exe file separately in an empty folder!
image-20231010185911059

Search for QT in win10 and open the command prompt in the red box:
image-20231010190017809
Go to the directory where the .exe was copied just now.
image-20231010190157192

Then enter: windeployqt .exe filename Enter.
image-20231010190258096
image-20231010190342010
At this point, you can see that many files appear in the 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 in order to run it!
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). After successful debugging, an 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.