【转】Qt/C++ 使用VS2015编译打包发布

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也类似。

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

2. VS2015依赖库

MD版本的程序需要的依赖库如下(把如下运行库拷出来放到当前exe文件路径下,要不然会遇到运行库错误):

【注】拷贝的方法:可以在C盘的Windows目录下搜索以下名称其中一个文件名,然后进入搜索到的文件的目录下,将整个目录下的文件均拷贝至exe文件路径下;总共分为core和crt两部分,值得注意!

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


如遇0xc0000007b,应该是你没把上面这些库放完整。感谢一位网友,提供的如上dll~

当然你如果使用VS与Qt的静态库开发的话,可以在VS中选择 运行库MT模式。你就不用这么操作了。 

参考

Qt+VS2015应用程序发布

发布了90 篇原创文章 · 获赞 6 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_37160123/article/details/96970402