Start of Qt programming in Ubuntu

Source: Internet
Author: User
1. Install the Qt Integration Environment sudoapt-getinstallqt4-dev-toolsqt4-docqt4-qtconfigqt4-demosqt4-designer2 In Ubuntu. Compile a simple Qt program to generate a simple window # include & lt; QApplication & gt; # include &

1. Install the Qt Integration Environment in Ubuntu

Sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos

2. Compile a simple Qt Program

Generate a simple window

# Include
# Include

IntMain ( IntArgc, Char* Argv [])
{
QApplication app (argc, argv );
QLabel * label = NewQLabel ( " Hello Qt! ");
Label-> show ();
ReturnApp.exe c ();
}

3. Generate a project file irrelevant to the platform

Www.linuxidc.com @ ubuntu :~ /MyTrain/Qt/Basic/hello $ qmake-project

4. Generate the makefile file

Www.linuxidc.com @ ubuntu :~ /MyTrain/Qt/Basic/hello $ qmake hello. pro

5. Generate the target file

Www.linuxidc.com @ ubuntu :~ /MyTrain/Qt/Basic/hello $ make

6. Execute the target file

Www.linuxidc.com @ ubuntu :~ /MyTrain/Qt/Basic/hello $./hello

7. Running result

Related Article

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.