Qt+VS2015应用程序发布

本文以Qt 5.9.1+VS2015编译环境为例介绍应用程序发布流程,也适用于Qt+mingw的情况。

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命令。

qmldir目录根据Qt版本和visual studio版本不同会步同,使用mingw也类似。

  1. 执行完上面的命令之后,相应的依赖库就会自动拷贝到exe所在的目录。

2. VS2015依赖库

MD版本的程序需要的依赖库如下:

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_Library

3. 常见问题

  • 如果提示“应用程序无法正常启动(0xc0000007b)。请单击“确定”关闭应用程序”,是因为缺少依赖库,检查是否遗漏了依赖文件。

  • 支持Windows XP、Server 2003
    如果需要支持windows xp和server 2003需要使用Qt 5.6.3及以下版本,并且在visual studio中选择“平台工具集”为"Visual Studio 2015 - Windows XP(v140_xp)"

posted @ 2017-10-16 12:53  jiangxueqiao  阅读(5485)  评论(0编辑  收藏  举报