Cross-platform Gui-install and configure QT windows Development Environment (eclipse CDT + mingw + QT)

Source: Internet
Author: User
1. Download and install QT
Go to the QT website (http://trolltech.com/developer/downloads/qt overview, download qt-win-opensource-4.3.2-mingw.exe directly, install it. This version has integrated the compilation environment mingw (Note: Only the compiling environment does not include IDE, and eclipse is the real IDE). You can select to automatically download and install mingw during the installation process.
  1.1. If you do not choose to install mingw during installation, you can also manually install
          1.1.1 manually install mingw
To the website http://sourceforge.net/project/showfiles.php? Group_id = 2435, download "automated mingw installer"
After the download is complete, click to run the mingw-5.1.3.exe application, select the installation directory, and it will automatically download the required files through the website.
            1.1.2 manual subcontracting and mingw Installation
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
The installation of QT and mingw is complete.
1.2 install the debugging tool GDB
First download GDB
Website: http://jaist.dl.sourceforge.net/sourceforge/mingw/gdb-6.3-2.exe
Download the package and install it in the mingw installation folder. With this function, you can use the debugging function of Eclipse.
2. Set environment variables for QT and mingw
Assume that the installed QT and mingw directories are:
D: \ QT \ 4.4.3;
D: \ mingw;
Right-click my computer and choose System Properties> advanced> environment variable.
Set the following environment variables
Add D: \ mingw \ bin and D: \ QT \ 4.4.3 \ bin and D: \ mingw \ mingw32 \ bin to path;
Add D: \ mingw \ Lib and D: \ QT \ 4.4.3 \ Lib to lib (if there is no Lib, create one );
Add D: \ mingw \ include and D: \ QT \ 4.4.3 \ include to include (if there is no include, create one );
Are you sure you want to set environment variables. At this time, a new environment variable has been started.
3. Download and install eclipse
Currently, eclipse + CDT can be integrated and downloaded. It seems that it has been optimized, and the speed is still relatively fast.
The download address is http://www.eclipse.org/downloads/. select export Eclipse IDE for C/C ++ developers.
4. Integrate QT and mingw into eclipse.
Download Eclipse plug-in address: http://trolltech.com/developer/downloads/qt/eclipse-integration-download
Select the eclipse and mingw paths you have installed before installation.
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", double-click "", select "clicked ()", double-click "", and 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.

Original post address: http://www.cnblogs.com/lansh/archive/2007/11/14/958808.html

Appendix: URLs and current versions of some major tools

Eclipse for C/C ++
Www.eclipse.org
Http://download.actuatechina.com/eclipse/technology/epp/downloads/release/ganymede/SR1/eclipse-cpp-ganymede-SR1-win32.zip

Mingw

Http://sourceforge.net/projects/mingw/

Http://nchc.dl.sourceforge.net/sourceforge/mingw/MinGW-5.1.4.exe

GDB

Http://sourceforge.net/projects/mingw/

Http://jaist.dl.sourceforge.net/sourceforge/mingw/gdb-6.3-2.exe

Qt

Http://trolltech.com/

Ftp://ftp.trolltech.com/qt/source/qt-win-opensource-4.4.3-mingw.exe

Qt eclipse integration for C ++

Http://dist.trolltech.com/developer/download/qt-eclipse-integration-win32-1.4.3.exe

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.