Qt+VS2015應用程序發佈

本文以Qt 5.9.1+VS2015編譯環境爲例介紹應用程序發佈流程,也適用於Qt+mingw的狀況。windows

1. Qt依賴庫

  1. 將須要發佈的exe(如test.exe),放到單獨的目錄。
  2. 在「開始菜單」啓動Qt 5.9.1 32-bit for Desktop (MSVC 2015),使用cd命令進入第1步中的目錄。
  3. 執行windeployqt.exe test.exe --qmldir C:\Qt\Qt5.9.1\5.9.1\msvc2015\qml命令。api

    qmldir目錄根據Qt版本和visual studio版本不一樣會步同,使用mingw也相似。工具

  4. 執行完上面的命令以後,相應的依賴庫就會自動拷貝到exe所在的目錄。debug

2. VS2015依賴庫

MD版本的程序須要的依賴庫以下:code

api-ms-win-core-console-l1-1-0.dll
api-ms-win-core-datetime-l1-1-0.dll
api-ms-win-core-debug-l1-1-0.dll
api-ms-win-core-errorhandling-l1-1-0.dll
api-ms-win-core-file-l1-1-0.dll
api-ms-win-core-file-l1-2-0.dll
api-ms-win-core-file-l2-1-0.dll
api-ms-win-core-handle-l1-1-0.dll
api-ms-win-core-heap-l1-1-0.dll
api-ms-win-core-interlocked-l1-1-0.dll
api-ms-win-core-libraryloader-l1-1-0.dll
api-ms-win-core-localization-l1-2-0.dll
api-ms-win-core-memory-l1-1-0.dll
api-ms-win-core-namedpipe-l1-1-0.dll
api-ms-win-core-processenvironment-l1-1-0.dll
api-ms-win-core-processthreads-l1-1-0.dll
api-ms-win-core-processthreads-l1-1-1.dll
api-ms-win-core-profile-l1-1-0.dll
api-ms-win-core-rtlsupport-l1-1-0.dll
api-ms-win-core-string-l1-1-0.dll
api-ms-win-core-synch-l1-1-0.dll
api-ms-win-core-synch-l1-2-0.dll
api-ms-win-core-sysinfo-l1-1-0.dll
api-ms-win-core-timezone-l1-1-0.dll
api-ms-win-core-util-l1-1-0.dll
api-ms-win-crt-conio-l1-1-0.dll
api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-multibyte-l1-1-0.dll
api-ms-win-crt-private-l1-1-0.dll
api-ms-win-crt-process-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-time-l1-1-0.dll
api-ms-win-crt-utility-l1-1-0.dll
concrt140.dll
msvcp140.dll
ucrtbase.dll
vcruntime140.dll

在安裝了vs2015的電腦上面找到這些文件,拷貝到exe所在的目錄便可。 也能夠直接今後處下載 VS2015_Release_Libraryserver

3. 常見問題

  • 若是提示「應用程序沒法正常啓動(0xc0000007b)。請單擊「肯定」關閉應用程序」,是由於缺乏依賴庫,檢查是否遺漏了依賴文件。
    blog

  • 支持Windows XP、Server 2003
    若是須要支持windows xp和server 2003須要使用Qt 5.6.3及如下版本,而且在visual studio中選擇「平臺工具集」爲"Visual Studio 2015 - Windows XP(v140_xp)"ip

相關文章
相關標籤/搜索