C + + GUI QT4 programming ( -1.1hello) Qt

Source: Internet
Author: User

1. According to C + + GUI QT4 Programming (second edition) finishing
2. System: CENTOS7; QT version: 5.5.1
3. Procedure: Hello.cpp

#include <QApplication> #include <qlabel>int main (int argc, char *argv[]) {    qapplication app (argc, argv) ;    Qlabel *label = new Qlabel ("Hello, qt!");    Label->show ();    return app.exec ();}

4. Qmake using aliases: $ alias qmake= "/opt/qt/qt5.5.1/5.5/gcc_64/bin/qmake"
5. Build platform-Independent project files: $ qmake-project
6. Generate platform-related makefile files: $ qmake 1.1.pro
7. Build the program to generate the executable program: $ make
8. Run the program: $./1.1
Note: 1.1 is the folder name


Summary of issues:
1. Hello.cpp:1:24: Fatal error: qapplication: no file or directory
Workaround: Open the 1.1.pro file and add the following 2 lines:
QT + + Core GUI
GreaterThan (Qt_major_version, 4): QT + = Widgets

C + + GUI QT4 programming ( -1.1hello) Qt

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.