Establishment of eclipse QT Development Environment

Source: Internet
Author: User

1. download eclipse
currently, eclipse + CDT can be integrated and downloaded. It seems that it has been optimized and the download speed is relatively fast.
the download address is http://www.eclipse.org/downloads/. select Eclipse IDE for C/C ++ developers to download the latest version:

http://www.eclipse.org/downloads/download.php? File =/technology/EPP/downloads/release/Galileo/SR1/eclipse-cpp-galileo-SR1-win32.zip

2. Download mingw
1) automatically install mingw
Download the installation file at http://sourceforge.net/projects/mingw/files.
Click to run the mingw-5.1.3.exe ApplicationProgram, Select the installation directory, it will automatically download the required files through the website. After installation, you need to set the directory to the system environment variables.

2) manually install mingw
To the website http://sourceforge.net/project/showfiles.php? Group_id = 2435, download the following installation package:
Binutils-2.17.50-20070129-1.tar.gz
Mingw-runtime-3.13.tar.gz
Mingw-utils-0.3.tar.gz
Mingw32-make-3.81-2.tar.gz
Gcc-core-3.4.5-20060117-1.tar.gz
Gcc-g00000000-3.4.5-20060117-1.tar.gz
W32api-3.10.tar.gz
Gdb-6.6.tar.tar

Decompress the package to a folder in sequence (when decompressing GDB, a file conflict is prompted, and you can directly overwrite it ).

3) Add the decompressed directory to the environment variable path.
If you decompress the package to D: \ mingw, add "D: \ mingw \ bin" to the system directory.

3. Download QT and Eclipse plug-ins
Go to the QT website (http://qt.nokia.com/developer/eclipse-integration) and download http://dist.trolltech.com/#/download/qt-eclipse-integration-win32-1.5.3.exe. the installation is now available.

4.install qt-eclipse-integration-win32-1.5.3.exe
Select the path to eclipse and mingw.

5. Development example:
1). Set eclipse
Choose "window"> "preferences..." from the menu to enter the parameter setting box. In QT, add the location and version number we just installed, for example:

2) Establish a QT Project
"File"-> "new"-> "New Project"
Select "qt gui project" and "Next" under the QT directory, and enter the project name. You only need to take the default value for the remaining one.

3) Add button on the form
Double-click the UI file in the project to open the form editing window.
In the menu "window"-> "show View"-> "other ..."
Select "qt c ++ widget box" and click "OK" to open the control window, for example:

Open the "qt c ++ signal slot Editor" window in the same way.

4) place two buttons in the window and right-click the button to modify objectname and text.
The two objectnames are: "button1", "button2 :".
Text: "show box", "close"

5) Add button events
In the "qt c ++ signal slot Editor" window, click the "+" icon, and a line of content appears in the window.
Double-click" ", Select" button2 ", and double-click" ", Select" clicked () "; double-click" ", Select" close ()".

Open the header file of the main window class (my name is qqq. h) and add the signal response part and function:
Private slots:
Void on_button1_clicked ();

The function format must be:On _ control name_event type ()

In the CPP file, add the header file and function entity:
# Include 
...
Void qqq: on_button?clicked ()
{
Qmessagebox box (this );
Box. settext ("Hello world! ");
Box.exe C ();
}

6) Compile and run the program in eclipse.
The effect is as follows:

Note:
1. The default QT for mingw installation does not install the debugging library. To run the debug mode, compile the debugging library as follows,
In the bin directory of QT, run the following command:
Qtvars. Bat compile_debug
To compile the debugging library.
It takes about 3 GB of disk space and about 4 hours of Compilation Time.

2.if qt-eclipse-integration-win32-1.0.0.exe is installed and the second startup of eclipse fails,
Go to the eclipse plugins directory and delete the file "com. trolltech. qtcppstartup_1.0.0.jar.

Reference: http://www.cnblogs.com/lansh/archive/2007/11/14/958808.html

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.