一、摘要:qt 程序开发后要发布打包,但是使用网上的教程,总是打这样那样的错误,如下面,我们总结一下原因,以及解决办法和注意事项
二、问题汇总
untitled01.exe-无法找到入口
无法定位程序输入点
ZNSt18condition variable4waitERSt11unique locklSt5mutexE于动态链接库D:Qt\Qt5.14.2\5.14.2\mingw73 32\bin/Qt5Core.dll
上。
untitled01
Thisapplication failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: direct2d, minimal, offscreen, webgl windows.
xxxx.exe-系统错误
由于找不到 Qt5Guid.dll,无法继续执行代码。重新安装程序可能会解决此问题。
确定
三、问题分析
3.1环境分析
win10 +qt-opensource-windows-x86-5.14.2.exe 安装了mingw73_32,mingw73_64,
刚开始msvc2015_64、msvc2017、msvc2017_64、winrt_armv7_msvc2015、winrt_armv7_msvc2017、winrt_x64_msvc2015、winrt_x64_msvc2017winrt_x86_msvc2017 这些没有安装,后来又卸载补装。
最后:
实际不安装全,也可以
3.2 打包方法分析
说明 示意项目名称 untitled01
方法一: 先在开始输入cmd 再定位到要打包的目录(失败)
在命令上中输入 D:\Qt\Qt5.14.2\5.14.2\mingw73_32\bin\windeployqt.exe +untitled01.exe
当前在准备发包的程序的当前目录
准备 命令路径 D:\Qt\Qt5.14.2\5.14.2\mingw73_32\bin\windeployqt.exe
回车
打印的脚本
D:\>d:
D:\>cd D:\workspace\windowdemo\build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release\release
D:\workspace\windowdemo\build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release\release>D:\Qt\Qt5.14.2\5.14.2\mingw73_32\bin\windeployqt.exe untitled01.exe
D:\workspace\windowdemo\build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release\release\untitled01.exe 32 bit, release executable
Adding Qt5Svg for qsvgicon.dll
Skipping plugin qtvirtualkeyboardplugin.dll due to disabled dependencies (Qt5Qml Qt5Quick).
Skipping plugin qtvirtualkeyboard_hangul.dll due to disabled dependencies (Qt5Qml Qt5Quick).
Skipping plugin qtvirtualkeyboard_openwnn.dll due to disabled dependencies (Qt5Qml Qt5Quick).
Skipping plugin qtvirtualkeyboard_pinyin.dll due to disabled dependencies (Qt5Qml Qt5Quick).
Skipping plugin qtvirtualkeyboard_tcime.dll due to disabled dependencies (Qt5Qml Qt5Quick).
Skipping plugin qtvirtualkeyboard_thai.dll due to disabled dependencies (Qt5Qml Qt5Quick).
Direct dependencies: Qt5Core Qt5Widgets
All dependencies : Qt5Core Qt5Gui Qt5Widgets
To be deployed : Qt5Core Qt5Gui Qt5Svg Qt5Widgets
Updating Qt5Core.dll.
Updating Qt5Gui.dll.
Updating Qt5Svg.dll.
Updating Qt5Widgets.dll.
Updating libGLESv2.dll.
Updating libEGL.dll.
Updating D3Dcompiler_47.dll.
Updating opengl32sw.dll.
Updating libgcc_s_dw2-1.dll.
Updating libstdc++-6.dll.
Creating directory D:/workspace/windowdemo/build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release/release/iconengines.
Updating qsvgicon.dll.
Creating directory D:/workspace/windowdemo/build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release/release/imageformats.
Updating qgif.dll.
Updating qicns.dll.
Updating qico.dll.
Updating qjpeg.dll.
Updating qsvg.dll.
Updating qtga.dll.
Updating qtiff.dll.
Updating qwbmp.dll.
Updating qwebp.dll.
Creating directory D:/workspace/windowdemo/build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release/release/platforms.
Updating qwindows.dll.
Creating directory D:/workspace/windowdemo/build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release/release/styles.
Updating qwindowsvistastyle.dll.
Creating D:\workspace\windowdemo\build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release\release\translations...
Creating qt_ar.qm...
Creating qt_bg.qm...
Creating qt_ca.qm...
Creating qt_cs.qm...
Creating qt_da.qm...
Creating qt_de.qm...
Creating qt_en.qm...
Creating qt_es.qm...
Creating qt_fi.qm...
Creating qt_fr.qm...
Creating qt_gd.qm...
Creating qt_he.qm...
Creating qt_hu.qm...
Creating qt_it.qm...
Creating qt_ja.qm...
Creating qt_ko.qm...
Creating qt_lv.qm...
Creating qt_pl.qm...
Creating qt_ru.qm...
Creating qt_sk.qm...
Creating qt_uk.qm...
Creating qt_zh_TW.qm...
D:\workspace\windowdemo\build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release\release>
双击:
双击无法运行,总是报错,排查越来,一时还摸不着头脑,急着打包,搞的一盆冷水。
网上很多资料都是采用这种方法,但是实操过程中,这个不行,也须是之前配置有qt的环境的问题,总之,这种方法存在不足
方法二、使用qt自带的命令符(成功)
准备打包程序路径
D:\workspace\windowdemo\build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release\release\untitled01.exe
当前是在qt 自带的命令符下面
输出日志:
D:\Qt\Qt5.14.2\5.14.2\mingw73_32>windeployqt.exe D:\workspace\windowdemo\build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release\release\untitled01.exe
D:\workspace\windowdemo\build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release\release\untitled01.exe 32 bit, release executable
Adding Qt5Svg for qsvgicon.dll
Skipping plugin qtvirtualkeyboardplugin.dll due to disabled dependencies (Qt5Qml Qt5Quick).
Skipping plugin qtvirtualkeyboard_hangul.dll due to disabled dependencies (Qt5Qml Qt5Quick).
Skipping plugin qtvirtualkeyboard_openwnn.dll due to disabled dependencies (Qt5Qml Qt5Quick).
Skipping plugin qtvirtualkeyboard_pinyin.dll due to disabled dependencies (Qt5Qml Qt5Quick).
Skipping plugin qtvirtualkeyboard_tcime.dll due to disabled dependencies (Qt5Qml Qt5Quick).
Skipping plugin qtvirtualkeyboard_thai.dll due to disabled dependencies (Qt5Qml Qt5Quick).
Direct dependencies: Qt5Core Qt5Widgets
All dependencies : Qt5Core Qt5Gui Qt5Widgets
To be deployed : Qt5Core Qt5Gui Qt5Svg Qt5Widgets
Updating Qt5Core.dll.
Updating Qt5Gui.dll.
Updating Qt5Svg.dll.
Updating Qt5Widgets.dll.
Updating libGLESv2.dll.
Updating libEGL.dll.
Updating D3Dcompiler_47.dll.
Updating opengl32sw.dll.
Updating libgcc_s_dw2-1.dll.
Updating libstdc++-6.dll.
Updating libwinpthread-1.dll.
Creating directory D:/workspace/windowdemo/build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release/release/iconengines.
Updating qsvgicon.dll.
Creating directory D:/workspace/windowdemo/build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release/release/imageformats.
Updating qgif.dll.
Updating qicns.dll.
Updating qico.dll.
Updating qjpeg.dll.
Updating qsvg.dll.
Updating qtga.dll.
Updating qtiff.dll.
Updating qwbmp.dll.
Updating qwebp.dll.
Creating directory D:/workspace/windowdemo/build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release/release/platforms.
Updating qwindows.dll.
Creating directory D:/workspace/windowdemo/build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release/release/styles.
Updating qwindowsvistastyle.dll.
Creating D:\workspace\windowdemo\build-untitled01-Desktop_Qt_5_14_2_MinGW_32_bit-Release\release\translations...
Creating qt_ar.qm...
Creating qt_bg.qm...
Creating qt_ca.qm...
Creating qt_cs.qm...
Creating qt_da.qm...
Creating qt_de.qm...
Creating qt_en.qm...
Creating qt_es.qm...
Creating qt_fi.qm...
Creating qt_fr.qm...
Creating qt_gd.qm...
Creating qt_he.qm...
Creating qt_hu.qm...
Creating qt_it.qm...
Creating qt_ja.qm...
Creating qt_ko.qm...
Creating qt_lv.qm...
Creating qt_pl.qm...
Creating qt_ru.qm...
Creating qt_sk.qm...
Creating qt_uk.qm...
Creating qt_zh_TW.qm...
D:\Qt\Qt5.14.2\5.14.2\mingw73_32>
双击运行成功
qt自带的cmd命令符还是有其优势的
四、对比结果
结论:
qt自带命令符比默认cmd打包出来的dll不一样加多一个文件
libgcc_s_dw2-1.dll
libstdc++-6.dll
libwinpthread-1.dll
结论:
qt自带的命令符,还是有有优势的,初学者,还是要使用自带的命令符,因为有很多的作用域问题
,如果你的作用域没有冲突,应当是使用任何一种方法都是一样的