当前位置:网站首页>QT static compiler (MinGW compilation)
QT static compiler (MinGW compilation)
2022-07-29 01:00:00 【I'm not Xiao Haiwa~~~~】
1. Why statically compile programs ?
By default , use QtCreator When compiling a program , Using dynamic compilation , This leads to the need to add corresponding Qt The library files , And a lot of dll file . If you want to package the generated program together with the required library into an executable program , And it can run on a computer without a development environment , Then you need to use static compilation .
2. Running environment
Windows10
QT Creator 4.11.0
QT 5.14.0 + Python 3.6 + gcc 7.3.0 + perl 5.22.1
3. Implementation steps
(1) install QT
QT5.14.0 Download address :http://download.qt.io/archive/qt/5.14/5.14.0/
Select the version shown in the figure to download

install QT when , Remember to check “Sources”
(2) install Perl
Download address :https://www.perl.org/get.html
Recommended download Strawberry Perl, Because compared with ActiveState Perl, It can be downloaded directly without registration
The installation directory :D:\SoftwareInstall\StrawberryPerl\perl
Environment variables are added automatically during installation , If you don't add , Manually add :
D:\SoftwareInstall\StrawberryPerl\perl\site\bin
D:\SoftwareInstall\StrawberryPerl\perl\bin
(3) install Python
Remember to check add during installation PATH environment variable
The installation directory :D:\SoftwareInstall\Python3.6
Environment variables are added automatically during installation , If you don't add , Manually add :
D:\SoftwareInstall\Python3.6\Scripts
D:\SoftwareInstall\Python3.6
(4) Installation environment inspection
open QT 5.14.0(MinGW 7.3.0 32-bit)
Enter the following command to check gcc Whether the compiler configuration is correct
gcc -v
Enter the following command to check perl Whether the interpreter configuration is correct
perl -v
Enter the following command to check python Whether the configuration is correct
python
Input exit() perhaps ctrl+z sign out python
(5) Configure static ratio compilation QT Information
stay D:\SoftwareInstall\Qt5.14.0\5.14.0 Create a new folder mingw73_32_static, For storing compiled files 
Switch to QT Source directory D:\SoftwareInstall\Qt5.14.0\5.14.0\Src
Enter the following command :
configure.bat -static -release -confirm-license -opensource -opengl desktop -platform win32-g++ -prefix "D:\SoftwareInstall\Qt5.14.0\5.14.0\mingw73_32_static" -sql-sqlite -sql-odbc -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -make libs -nomake tools -nomake examples -nomake tests -skip qt3d -skip qtcanvas3d -skip qtdatavis3d -skip qtlocation -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview
(6) Start compilation ( Longer time , about 3-4 Hours )
In the (5) When step configuration is completed and no error message is output , You can start compiling , In the command line window just now, enter the following command to compile :
mingw32-make
If the computer has good performance , You can use multithreading to compile :
mingw32-make -j2
ps: What we use here is 2 Threads
(7) install
After compiling , Enter the following command in the command line window just now to install :
mingw32-make install
After installation , You can do it in mingw73_32_static in , See the following :
(8) Related configuration
modify D:\SoftwareInstall\Qt5.14.0\5.14.0\mingw73_32_static\mkspecs\common\g+±win32.conf
stay conf Add... To the file QMAKE_LFLAGS = -static
stay conf Modification in file QMAKE_LFLAGS_DLL = -static

(9)QT Creator Configure the static compiler
Tools -> Options 


Clone an original , And modify the options in the red box below 
https://blog.csdn.net/gaolijing_/article/details/106822446
边栏推荐
- Execute immediate simple sample set (DML)
- Data warehouse construction - ads floor
- 追踪伦敦银实时行情的方法有哪些?
- Kwai focuses on regulating the number maintenance behavior in the ways of handling and manuscript washing, and how to purify the content ecology on the we media platform
- Outlier detection and Gan network (1)
- Anomaly detection and unsupervised learning (1)
- Matlab02: structured programming and function definition "suggestions collection"
- Android必备的面试技能(含面试题和学习资料)
- Error reporting: when the browser clicks the modify add button, there is no response and no error reporting. Solution
- 【刷题笔记】从链表中删去总和值为零的连续节点
猜你喜欢

【AD学习】本次海上航行器大赛画pcb图的历程

ZABBIX deployment and monitoring
![Error reporting: the network preview shows {xxx:['this field is required']}](/img/96/b0a6c01543fcbcc6d3262b3797fae2.jpg)
Error reporting: the network preview shows {xxx:['this field is required']}

Consumer unit 消费单元

管理区解耦架构见过吗?能帮客户搞定大难题的

小程序毕设作品之微信校园浴室预约小程序毕业设计成品(6)开题答辩PPT
![[raspberry pie] how does the windows computer connect with raspberry pie](/img/d6/42685bbc4e4af757867442b63ce9c8.png)
[raspberry pie] how does the windows computer connect with raspberry pie

状态压缩dp-蒙德里安的梦想

selenium对接代理与seleniumwire访问开发者工具NetWork

Charles -- 从0-1教你如何使用抓包工具
随机推荐
Wechat campus bathroom reservation applet graduation design finished product (8) graduation design thesis template
DRF - web development mode, API interface, API interface testing tool, restful specification, serialization and deserialization, DRF installation and use
时间序列数据的预处理方法总结
【刷题笔记】二进制链表转整数
SurfaceControl和SurfaceFlinger通信
异步模式之工作线程
Outlier detection and open set identification (2)
Educational Codeforces Round 132 (Rated for Div. 2)【A~C】
B- 树 ~
消费行业数字化升级成“刚需”,weiit新零售SaaS为企业赋能!
自制 | 纯手工自制一个16位RISC架构CPU
DRF - paging, JWT introduction and principle, JWT quick use, JWT source code analysis, JWT custom return format, custom user issued token, custom token authentication class
面试突击69:TCP 可靠吗?为什么?
What opportunities does the London gold real-time market bring?
【刷题笔记】从链表中删去总和值为零的连续节点
ActiveMQ基本详解
Daniel guild Games: summary and future outlook of this year
What are the methods to track the real-time market of London Silver?
Andriod6.0 low power mode (turn off WiFi, Bluetooth, GPS, screen brightness, etc.)
Outlier detection and open set identification (1)