Use mingw, msys, and QT to write the interface in windows.

Source: Internet
Author: User
If you want to write interfaces in windows, there are many c ++ interface libraries, such as the built-in MFC Library in VC ++. However, if you use these libraries ProgramPorting to other platforms is a very painful process. QT is a very good C ++ interface library, which is cross-platform, well-structured and easy to use. Now we will briefly introduce how to use mingw and msys to compile QT programs in windows.
1) install mingw and msys
2) install QT
Download the corresponding installation file and install it all the way. After installing QT, add the QT path to the environment variables of windows. Here is:
C: \ QT \ 4.4.3 \ bin
In this way, you can use the QT command at any location in cmd.
3) set the hello World Section CodeCopy it in. The help files of QT include:
# Include <qapplication>
# Include <qpushbutton>
Int main (INT argc, char * argv [])
{
Qapplication app (argc, argv );
Qpushbutton Hello ("Hello world !");
Hello. Show ();
Return app.exe C ();
}
To facilitate compilation, you can save the code file to a single folder.
4) use qmake to create a project
Qmake-Project
Qmake
Run the preceding two commands in the target code folder. The first command generates a qthello. pro file, the second command qmake will be based on this. pro file to create makefile files related to the platform.
5) run the make command in msys for compilation.
If the compilation succeeds, the two sub-folders debug and release will be created under this folder, which contains the executable files generated after you make.

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.