一、静态编译发布
1.0:以Release模式构建工程
1.1:查看当前构建生成路径,并将所生成的.exe单独拷贝出来
1.2:将可执行文件*.exe拷贝至任一目标文件夹:D:\Temporary\QQIF
2:查看安装Qt时发布工具windeployqt.exe所在的目录
windeployqt.exe在Qt开发套件的bin目录下。Qt的每一个开发套件都有独立的目录。
(注意:需要判断自己生成的程序时32位还是64位)
C:\Qt\6.7.1\mingw_64\bin\windeployqt.exe
C:\Qt\6.7.1\mingw_64\bin\windeployqt6.exe
C:\Qt\6.7.1\msvc2019_64\bin\windeployqt.exe
C:\Qt\6.7.1\msvc2019_64\bin\windeployqt6.exe
3:windeployqt.exe工作原理很简单,它会到当前的环境变量PATH配置的搜索路径中,查找应用程序所需要的库和资源,拷贝到应用程序目录中。
命令格式:windeployqt.exe 应用程序完整路径
以mingw_64开发套件为例,为避免多套件版本问题,使用绝对路径运行windeployqt,在*.exe所在目录中,执行以下任一命令:
> C:\Qt\6.7.1\mingw_64\bin\windeployqt --release --no-quick-import --no-translations .\SerialDataAnalyze.exe
> C:\Qt\6.7.1\mingw_64\bin\windeployqt6 --release --no-quick-import --no-translations .\SerialDataAnalyze.exe