C + + Qt framework Static compilation operation record

Source: Internet
Author: User

Who wants to write a program that comes with a bunch of DLLs, especially names with such obvious names.

So in the online look, it is necessary to download the source code and then compile, but looked at others said the compilation time, up to a few hours, an instant feel do not want to do. Because I need to grab the time code.

So the use of a search engine to find a Qt 5.1 has been statically compiled after the package. At the end of the article we will provide, in order to save valuable time, we use the others have compiled the package for static compilation.

First we download QT 5.1(at the end of the article)

And then I put it directly under the C-plate.

Open qt Creator Tools, Options.

Then we add the QT version that we just downloaded

Click Add (ignoring what I have here)

So we chose Qt/5.1.0-rel-static/bin/qmake.exe.

You can see that you have added the

(As for the name or whatever, just grab it.%{qt:version} is a variable)

Then we click on the Kits option clip

Create a new kit, pay attention to yourself, as for the compiler, you can install QT when you should have an option to let you download, no words, you can only download the

Then we create a new project:

There is an option. Select the kit you just created

Then, if your program is written, you can click "Compile" to compile it statically;

Note Mode to select Release mode

At this point, I believe you can already generate a large volume of EXE program, with your QT program run around it.

After my testing, Windows 7 32-bit/64-bit Windows 10 64-bit/32-bit Windows Xp 32-bit Windows 2003 32-bit will work correctly.

The resulting file size is a bit large and the memory footprint is slightly higher, but it is a good framework for making the C + + interface. but it is worth mentioning that I used QT to make a console program, the program configuration removed the interface library:

Pro Project configuration file:

1 QT + + core    #加入核心库 2qt-= GUI   #删除界面库 3qt + = network  #加入网络库  4config + = c++11 #C ++11 standard 5  6TARGET = suwings  7CONFIG + = Console #添加控制台 8CONFIG-= app_bundle  9TEMPLATE = App  One  rc_file = suwings.rc

The project file has 26 files, the code totals about 3000 lines, the resulting file appears to be:

About 4MB, especially when the program is running, the memory occupies between 0.9MB~1.5MB;

So I think if we get rid of the interface library, it might be a good benefit.

But if you don't even have the interface, what do you do with QT? But it is true that QT has provided us with an almost complete set of frameworks that allow me to find a sense of writing Java.

Qt Compiled package:http://pan.baidu.com/s/1eSnys1s

A few links are recommended below:

Qt Download:https://www.qt.io/download/

Qt Self-study road:https://www.devbean.net/category/qt-study-road-2/page/10/

Qt Official document:http://doc.qt.io/qt-5/qtgui-module.html

Qt Chinese document (a bit old):http://www.kuqin.com/qtdocument/index.html

Thank you for your patience to read and hope to help you.

C + + Qt framework Static compilation operation record

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.