Use commands on Ubuntu to create your first Qt Program

Source: Internet
Author: User
Note: This document assumes that you have successfully installed QtSDK on your operating system in Ubuntu. If not, refer to this URL: Installation

Note: This document assumes that you have successfully installed the Qt SDK on your operating system in Ubuntu. If not, see this URL: http://www.linuxidc.com/Linux/2012-11/74757.htm

Steps:

1-> open a terminal and enter the following command to create the main directory of a Qt Program

Mkdir QtHelloWorld

2-> run the following command to change the QtHelloWorld directory:

Cd QtHelloWorld

3-> In the QtHelloWorld directory, we want to create the source code file of our Qt program.

Gedit main. cpp

4-> now add the code at the bottom to the source code file of your main. cpp, save the file, and exit

5-> In the QtHelloWorld directory, enter the following command:

Qmake-project

Qmake

Make

6-> the QtHelloWorld directory contains a "QtHelloWorld" executable file. Run the following command:

./QtHelloWorld

  1. # Include
  2. # Include
  3. # Include
  4. IntMain (IntArgc,Char* Argv [])
  5. {
  6. QApplication app (argc, argv );
  7. QLabel hello (" Welcome to my first WikiHow Qt program ");
  8. Hello. setWindowTitle ("My First WikiHow Qt Program ");
  9. Hello. resize (400,400 );
  10. Hello. show ();
  11. ReturnApp.exe c ();
  12. }

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.