參考:https://blog.csdn.net/windsnow1/article/details/78004265
qt生成的exe檔案如果沒有打包發行,在一般的電腦是無法運作的。
準備工作:
1、qt生成的exe檔案:必須是release模式生成的exe檔案。
2、打包工具:Engima Virtual Box。百度這個即可下載下傳。
打包步驟:
1、打開關于release相關的檔案夾,找到該目錄下release目錄下的.exe程式。此時你點選是運作不成功的。因為缺少QT必要的庫檔案。将這個.exe檔案拷貝出來,建立一個單獨的檔案夾,放在這個檔案夾下。 如:F:\demo
2、在win10下,搜尋QT,如下圖:

打開紅色标記的指令視窗 :
1)輸入如下指令:進入exe檔案所在的目錄:
C:\Qt\Qt5.3.2\5.3\mingw482_32>cd /d F:\demo
C:\>cd /d D:demo
windeployqt yuyue_disp_0117.exe
2)輸入如下指令:windeployqt 程式名 敲擊回車。這一步操作是将所需的庫檔案全都拷貝到exe程式的目前檔案:
F:\demo>windeployqt xxxx.exe
F:\demo\yuyue_disp_0117.exe 32 bit, release executable
Skipping plugin qtaccessiblequick.dll due to disabled dependencies.
Adding Qt5Svg for qsvgicon.dll
Direct dependencies: Qt5Core Qt5Gui Qt5PrintSupport Qt5Sql Qt5Widgets
All dependencies : Qt5Core Qt5Gui Qt5PrintSupport Qt5Sql Qt5Widgets
To be deployed : Qt5Core Qt5Gui Qt5PrintSupport Qt5Sql Qt5Svg Qt5Widgets
Updating icuin52.dll.
Updating icuuc52.dll.
Updating icudt52.dll.
Updating Qt5Core.dll.
Updating Qt5Gui.dll.
Updating Qt5PrintSupport.dll.
Updating Qt5Sql.dll.
Updating Qt5Svg.dll.
Updating Qt5Widgets.dll.
Updating libgcc_s_dw2-1.dll.
Updating libstdc++-6.dll.
Updating libwinpthread-1.dll.
Creating directory accessible.
。。。
得到demo目錄如下:
3、打開運作Enigma Virtual Box:
4、打包完成後,我們的工作就完成了,去程式打包後的路徑點選運作吧。