使用bat快速生成qt程序依赖dll

 

新建.bat文件,复制到exe路径下执行即可

 

使用vs编译器时候

set PATH=C:\Qt\5.15.0\mingw81_32\bin\
for /f "delims=" %%A in ('dir /b *.exe') do set "file_exe=%%A" 
echo %file_exe%
windeployqt %file_exe%

echo pause

  

 

使用GCC时候要多复制几个文件

set qt=C:\Qt\5.15.0\mingw81_32\bin\
set build=%~dp0

%qt%windeployqt.exe  %build% 

del %build%*.o
del %build%*.cpp
del %build%*.h

copy %qt%libgcc_s_dw2-1.dll %build%
copy "%qt%libstdc++-6.dll" %build%
copy %qt%libwinpthread-1.dll %build%

pause

 

2021.06.10 自用版本

@echo off
set qt=C:\Qt\5.15.0\mingw81_32\bin\
set build=%~dp0

%qt%windeployqt.exe  %build% 

copy %qt%libgcc_s_dw2-1.dll %build%
copy "%qt%libstdc++-6.dll" %build%
copy %qt%libwinpthread-1.dll %build%
copy %qt%libmysql.dll %build%

del %build%*.o
del %build%*.cpp
del %build%*.h



pause

 

posted @ 2021-05-11 21:43  hiwjy  阅读(222)  评论(0编辑  收藏  举报