Install Qt in windows and run the first program

Source: Internet
Author: User

Install Qt in Windows:

In Windows, install mingw first, and then install QT. The installation process is relatively simple and can be done as prompted ..

Note: During the QT installation process, you will be prompted to select the mingw installation directory, and will be prompted to automatically set the environment variables (automatically set by default)

 

-----------------------------------------------------

 

In QT, the first program runs:

 

1. Copy the following program to the file "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.exe C ();

}

 

 

2. Save the file "Hello. cpp" in the directory "D:/QT/test/1/Hello" (select the directory based on the actual situation)

 

3. Select "QT 4.1.4 Command Prompt, enter the command line interface, and enter the directory that just saved "Hello. cpp" (mainly use the doc command: cd d:/QT/test/Hello)


 

4. At the end of the command prompt, enter:

Qmake-Project

(To create a platform-independent project file (Hello. Pro))

Qmake hello. Pro

(To create a platform-specific makefile from the project file)

Make

(To build the Program)

 

5. After the preceding three steps, you can obtain the following files in the directory where "Hello. cpp" is located:

 

6. In this directory, click the "release‑folder" to display the executable program "hello.exe" under Windows ":

 

 

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.