Install QT SDK and first Hello QT program under Ubuntu

Source: Internet
Author: User

1. On the official website (http://qt.nokia.com/downloads/downloads) Download the SDK, the default recommended online installation.

Download get file Qt_sdk_lin32_online_v1_1_3_en.run

Run directly (./file name)

Select the installation directory, where I select My home directory (/home/username)

2. After installation, there is a qtsdk folder in the home directory, the folder is a QT library 4.7.4, Qt Creator 2.3.0, Qt Simulator for Symbian/meego, Qt Mobility 1.2.0, Remote All development tools such as compilers


3. Install to this end, set environment variables below. The bin directory of the integrated QTSDK is difficult to find (/home/user name/qtsdk/desktop/qt/474/gcc/bin)

sudo vi/etc/profile

In Export path= ... Continue adding content later, note separated by colons (:/above directory)

Make the configuration file effective immediately: Source/etc/profile

4. You can now use QT to write our first program.

5. Create a new QT directory under the user directory, vi hello.cpp

#include <QApplication>
#include <QLabel>

int main (int argc, int *argv[])
{
    qapplication App (argc, argv);
    Qlabel *label = new Qlabel ("Hello qt!");
    Label->show ();
    return app.exec ();
}
5. Save exit, enter the following command to generate a platform-independent project file Hello.pro:

Qmake-project
6. Then, enter the following command to generate a platform-related makefile file from this project file:

Qmake Hello.pro
7. Type the make command to build the program.

Make
8. Run the program

./hello
You can see the program run result diagram:







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.