Qt exe自动拷贝依赖dll

windeployqt 找出依赖,并自动拷贝到当前目录


通过 Qt "D:\Qt\Qt5.4.0\5.4\msvc2013_64\bin\windeployqt.exe" 命令找出依赖的库


windeployqt QtWebApp.exe

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
D:\qtcode\build-QtWebApp-Desktop_Qt_5_4_0_MSVC2013_64bit-Release\tmp\QtWebApp.ex
e64bit,releaseexecutable
Directdependencies:Qt5CoreQt5NetworkQt5sql
Alldependencies:Qt5CoreQt5NetworkQt5sql
Tobedeployed:Qt5CoreQt5NetworkQt5sql
Warning:Cannot find VisualStudioinstallationdirectory,VCINSTALLDIRisnots
et.
Updatingicuin53.dll.
Updatingicuuc53.dll.
Updatingicudt53.dll.
UpdatingQt5Core.dll.
UpdatingQt5Network.dll.
UpdatingQt5sql.dll.
Creatingdirectorybearer.
Updatingqgenericbearer.dll.
Updatingqnativewifibearer.dll.
Creatingdirectorysqldrivers.
Updatingqsqlite.dll.
UpdatingqsqlMysqL.dll.
UpdatingqsqLoci.dll.
Updatingqsqlodbc.dll.
Updatingqsqlpsql.dll.

所依赖的 Qt 库都会自动拷贝到当录下!

注意:

Warning: Cannot find Visual Studio installation directory,VCINSTALLDIR is not s

et

直接用 "VS2013 开发人员命令提示" 命令行去,执行刚才的windeployqt QtWebApp.exe,会将 "vcredist_x64.exe"(vc x64 运行最少环境)程序放入当前目录。


建议:将所用到的库与开发环境的路径都放入 PATH 环境变量中设置好,这样使用windeployqt 都能找到对应的 dll.当然使用对应的 工具的 "命令行工具" 也是可以的!



Qt绿色版的程序就这样生成完成!

相关文章

迭代器模式(Iterator)迭代器模式(Iterator)[Cursor]意图...
高性能IO模型浅析服务器端编程经常需要构造高性能的IO模型,...
策略模式(Strategy)策略模式(Strategy)[Policy]意图:定...
访问者模式(Visitor)访问者模式(Visitor)意图:表示一个...
命令模式(Command)命令模式(Command)[Action/Transactio...
生成器模式(Builder)生成器模式(Builder)意图:将一个对...