The dynamic link library used by the official QT development environment requires a large stack of DLLs to be copied when the generated EXE is released.
If you go to copy the DLL, it is likely to absent-minded, causing EXE in another computer does not work properly.
So the QT official development environment comes with a tool: Windeployqt.exe.
Take the official Qt 5.4.0+MINGW development environment as an example,
From the Start menu-"Qt 5.4.0--" 5.4--"MinGW 4.9 (32-bit)-" QT 5.4 for Desktop (MinGW 4.9), you can open the QT command line, where you can execute the WINDEPLOYQT tool.
Integrated development Environment Qtcreator currently generates graphical interface program EXE can be divided into two categories:
QT Widgets Application and QT Quick application.
Here are the two types of EXE publishing methods.
1, Qt Widgets application executable Program Publishing method
First use Qtcreator to create a new Qt Widgets application project, directly with the default Qmainwindow program on it, the project name is assumed to be hellomw.
And then build the EXE program in Release mode:
After the generated program runs normally, locate the project's build directory, such as the project source path:
C:\QtPros\hellomw\
Its Project build directory is
C:\QtPros\build-hellomw-Desktop_Qt_5_4_0_MinGW_32bit-Release\
Go to this folder, go inside the subfolder of it, find Hellomw.exe,
Copy this exe to a new, separate folder for publishing, such as Save to
D:\hellomw\ folder inside.
Then open the Qt command line from the Start menu and enter the command:
CD/D D:\HELLOMW
Then use the WINDEPLOYQT tool command:
WINDEPLOYQT Hellomw.exe
You can then see the plugins folder that the WINDEPLOYQT tool automatically replicates in the D:\HELLOMW folder
and DLL files, QM files. At this time to get the complete EXE program release collection, the dependency relationship is resolved.
The D:\HELLOMW folder can be released, you do not have to find the DLL file.
The QM file in the D:\HELLOMW folder is a multi-lingual translation file, which does not need to be deleted.
The rest is reserved.
2, Qt Quick Application Release method
First use Qtcreator to create a new Qt Quick application project, directly with the default project template, click Next to build the project, the project name is assumed to be helloqml.
And then build the EXE program in Release mode:
Then find the project's build directory, such as project source directory C:\QTPROS\HELLOQML,
Its build directory is:
C:\QtPros\build-helloqml-Desktop_Qt_5_4_0_MinGW_32bit-Release\
Enter this directory, then go to the Release subfolder, find Helloqml.exe,
Copy to a new, separate folder, such as the D:\helloqml\ folder.
Then open the Qt command line from the Start menu and go to the D:\helloqml\ folder:
CD/D D:\HELLOQML
Then use the WINDEPLOYQT tool command:
windeployqt Helloqml.exe--qmldir C:\Qt\Qt5.4.0\5.4\mingw491_32\qml
Be careful not to copy the same command as Burn,--qmldir is to point out the QML folder location inside the Qt library,
The above command C:\Qt\Qt5.4.0 is the QT official development environment installs the folder,
C:\Qt\Qt5.4.0\5.4\mingw491_32 is a directory of Qt class libraries (Qtdir),
So the use of--qmldir is written behind the C:\QT\QT5.4.0\5.4\MINGW491_32\QML
Reader QT Environment installation path is not the same, to modify according to the actual situation!
You can then see a lot of files in the D:\helloqml folder, which is the dependent file that the Qtquick program needs.
Package the entire D:\HELLOQML folder to be published and used on other computers.
This D:\helloqml folder in a lot of things, do not understand do not delete, honest packaging released on the line.
The above is the simplest program release, the actual complex program may also take some picture files, database files, configuration files and so on, you can add these files to the publishing folder as you want.
http://tieba.baidu.com/p/3730103947
QT Official development environment generated EXE publishing method-Using WINDEPLOYQT