Create a QT development environment in Windows

Source: Internet
Author: User

QT is a powerful cross-platform GUI system. I have liked some of the features I have come into use.

Currently, the main task is to run Qt in Linux on the ARM platform.Program. However, I always want to use it in windows ~

After finding some information on the Internet, I finally configured the QT development environment on the Windows platform and recorded it. I will share it with you:

 

1. Required Software

Qt must be required. The download speed on the official QT website is relatively slow. We recommend that you download it at the following address:

Qt for Windows v4.4.0:

Http://www.qtcn.org/download/qt-win-opensource-src-4.4.0.zip
Ftp://ftp.trolltech.com/qt/source/qt-win-opensource-src-4.4.0.zip
Ftp://ftp.trolltech.com/qt/source/qt-win-opensource-4.4.0-mingw.exe

Qt for Windows v4.3.5:

Http://www.qtcn.org/download/qt-win-opensource-src-4.3.5.zip
Http://www.qtcn.org/download/qt-win-opensource-4.3.5-mingw.exe
Ftp://ftp.trolltech.com/qt/source/qt-win-opensource-src-4.3.5.zip
Ftp://ftp.trolltech.com/qt/source/qt-win-opensource-4.3.5-mingw.exe

All of the above are opensource'sCode. When downloading, I downloaded the EXE format, which is more convenient for installation. I have not tried the ZIP format for the moment. I will try again later.

 

Another required software is mingw. According to the information found on the Internet, there is an integrated development environment called Dev-C ++ that comes with the mingw editor, and it is said that it is better to edit the code. But I am a newbie. Well, I won't do it first ~

Mingw can be downloaded here:

Http://www.mculee.cn/upload/MinGW-3.4.2.exe (before looking for a lot of addresses on the Internet, many are online installation, I did not succeed once anyway, it is not easy to get an offline installation, you need to hurry Ah ~~)

 

Ii. Install software

Theoretically, there is no limit on the path for installing software. But I like to install it in the root directory of a disk, so the path is relatively short (hey, it is actually lazy ).

Install mingw first. I installed e: \ mingw

Then install QT. The following dialog box is displayed during installation:

Select the mingw folder (I am E: \ mingw ).

My QT is installed on E: \ QT \ 4.3.5 (because our development board runs 4.3.5, this version is also installed here)

 

3. Set Environment Variables

Environment variables can be set to identify QT and mingw commands under Windows command lines.

The following environment variables need to be set:

Path = E: \ QT \ 4.3.5 \ bin; % PATH %; E: \ mingw \ bin (the order does not matter)

In addition to the PATH environment variable, you also need to create two environment variables:

Qtdit = E: \ QT \ 4.3.2

Qmakespec = win32-g ++ (note that this must be a win32-g ++, here does not refer to the G ++ compiler under mingw !!)

 

So far, the establishment of the QT development environment in Windows is complete.

 

Iv. Test code

Next, you can write a simple test code to test the effect :-)

 

# Include <qapplication>

# Include <qpushbutton>

Int main (INT argc, char * argv [])
{
Qapplication app (argc, argv );
Qpushbutton screen ("Hello, QT world! ");
Screen. Show ();
Return app.exe C ();
}

 

Save as main. cpp, open the command line window, switch to the directory where main. cpp is located, and then execute:

Qmake-Project

Qmake

Make

Wait a moment. We can see that our test code has been compiled successfully:

OK. Run the command. Find the generated EXE file in the release folder and double-click it to execute:

Haha, the effect is good, and the sense of accomplishment is soaring ~~

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.