首页 > 技术文章 > Qt - 使用windeployqt发布Qt生成的exe软件

Pan-Z 2017-03-27 17:40 原文

windeployqt工具作用:  

The Windows deployment tool is designed to automate the process of creating a deployable folder containing the Qt-related dependencies (libraries, QML imports, plugins, and translations) required to run the application from that folder. It creates a sandbox for Windows Runtime or an installation tree for Windows desktop applications, which can be easily bundled into an installation package。

使用方法:

工程名称“DCP”,为一通信程序,包含第三方库ControlCAN.dll,以及图标文件夹;

1,生成exe程序时,选择“Release”;

2,在项目文件夹中build-DCP-Desktop_Qt_5_7_0_MinGW_32bit-Release把DCP.exe拷贝到其他文件夹中,本次试验在E盘根目录创建DCPApp文件夹,将DCP.exe拷贝此文件夹中;

3,打开Qt5.7 for desktop,如下图:

4,切换到E盘DCPApp文件夹,命令如下:

5,输入windeployqt DCP.exe,工具自动查找依赖的库和翻译文件以及图标:

6,将第三方库文件ControlCAN.dll拷贝到DCPApp文件夹中,所有文件如下

7,将DCPApp文件夹拷贝到其他电脑,运行DCP.exe即可实现软件运行。

推荐阅读