Qt5 packaging - using its own windeployqt.exe and tools Enigma Virtual Box

table of Contents

run

Add dependent

Released as a single exe form


run

Select Release version, run once

Release

After the run will find more Release version, there are exe, but double-click find missing some dynamic link library.

Click the lack of direct dynamic-link library

Add dependent

In your Qt installation package for the following will be windeployqt.exe file, it can help you add dependencies.

windeployqt.exe directory

In your release folder, use cmd command to package, is your windeployqt.exe path + space + your exe, for example as follows:

E:\Qt5.9.1\5.9.1\mingw53_32\bin\windeployqt.exe maze.exe
pause

If your software is not the final version, the command can be written .bat file, double-click to run, to save trouble.

command

After running a command or double-click your .bat file, you will find add some dependencies, create some files

Add partially dependent on success

If you appear on the map, there is no error, skip the next paragraph

Why write pause it? Because there may be a failure, such as: This to Start Because the Application failed The IT could not the Find or the Load at The Platform Qt plugin "Windows" , because some of the software with Qt as the bin system variables, such as Anaconda, in my the Path variable to find it, delete it, plus the package.

Path variable

You will see the release there are some dependencies, driving and other such related to the database's icon.

After the success of add-dependent

If you link to a database, such as mysql, you will need a dynamic link library and put that under your .exe in the same directory, libmysql.dll position as follows, bin directory files are installed in the following folder Qt

libmysql.dll position

 

添加libmysql后

至此,你直接双击.exe文件和你在Qt运行时应该一模一样了。

发布成单一exe形式

利用下面的软件,免费的,可以从官网下载

Enigma Virtual Box

打开软件,选择要打包的exe文件及打包后的文件目录

浏览exe

点击File Options选项,在点击Compress Files复选框,这样打包后的exe比较小

选择压缩

 点击Add,添加刚才依赖后生成的所有文件(包括.dll、.db文件等)以及生成的文件夹及里面的内容(文件夹自己建,然后在新建的文件夹里面添加对应文件)

添加文件及文件夹

点击Process进行压缩打包,最后显示成功即可。

标题

你可以点击Run或者在你选的文件夹里面双击你的单一的exe文件即可

生成的单一文件

至此,大功告成!!!

有问题请下方评论,转载请注明出处,并附有原文链接,谢谢!如有侵权,请及时联系。

发布了163 篇原创文章 · 获赞 471 · 访问量 26万+

Guess you like

Origin blog.csdn.net/lady_killer9/article/details/89975504