Configuration of the QT development environment in Windows

Source: Internet
Author: User

There are too many articles on QT configuration in windows on the internet, each of which has its own opinions. After some exploration, I finally configured the QT development environment in windows. First, it is noted that QT open source does not support Visual Studio, because QT regards this function as a function in QT clinical ical. Therefore, do not use Qt in vc6.0 or vs2005. Of course, I have not tried it myself. I have translated a sentence on the qt website.

Qt for Windows has two formats: EXE and SRC. Of course, here I recommend you download files in the EXE format, because you don't need to perform complicated configuration and compilation, just click OK.

I. installation and configuration of QT for windows in EXE format

1. Install mingw. This is required. I will not say much about where to download it. I use mingw 3.4.2. It is also the mingw in EXE format. Just click OK. Of course, it is best to install it in C:/mingw, because it is easy to find. Haha

2. Install QT for windows in EXE format. When the installation process prompts the installation path of mingw, the default path is C:/mingw. Therefore, you only need to run OK. The default installation path for Qt for Windows is C:/QT/4.4.3/. Of course, my QT version is 4.4.3.

3. Add the bin directory of QT for windows to the environment variables by using the following method: My computer> Properties> advanced> environment variables. Find the environment variable named path, click Edit and add C:/QT/4.4.3/to the end. Of course, the path must be separated from the original path by a semicolon.

4. test whether the configuration of QT for Windows is successful. Click Start> QT for Windows> QT command prompt. In QT command prompt, it has automatically set the environment variables required for compilation. Enter "edit" and enter the following program: # include <qapplication>
# Include <qfont>
# Include <qpushbutton>

Int main (INT argc, char * argv [])
{
Qapplication app (argc, argv );

Qpushbutton quit ("quit ");

Quit. Resize (75, 30 );
Quit. setfont (qfont ("Times", 18, qfont: bold ));

Qobject: connect (& quit, signal (clicked (), & App, slot (quit ()));

Quit. Show ();

Return app.exe C ();
}

Save it as main. cpp, exit edit, and run the CD command to enter the directory for saving Main. cpp. The directory for saving Main. cpp is "hello", and then run the following command:

Qmake-Project

Hello. Pro will be generated later, and then run: qmake hello. Pro

A lot of files will be generated later, and then run: Make

Then, the main.oand hello.exe will be displayed in the debugdirectory. After hitting hello.exe, the following window appears:

 

Now, everything is so OK.

Ii. Installation of QT for windows in SRC format

1. Install mingw

2. Add C:/QT/4.4.3/bin to the environment variables of the system. For how to add these variables, see the preceding section.

3. "Run"-"cmd"-"

C:
CD/QT/4.2.3
Configure

If VC is installed, run the: Configure-platform win32-msvc

After running configure, run qmake again. If you are running the configure-platform win32-msvc command above, run nmake

After that, the configuration is complete.

Summary: I have personally verified the configuration of QT for windows in EXE format. For the configuration of QT for windows in SRC format, I refer to the QT website, so I have not personally verified it. It is not guaranteed that the latter will succeed.

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.