We need an IDE for development. (Dev C++, VS .Net, QT Creator, Eclipse)
Here we choice QT Creator to achive this goal, so you have to download the QT Creator for windows in official site.
qt-creator-win-opensource-2.1.0.exe (included MinGW).
http://qt.nokia.com/downloads/qt-creator-binary-for-windows
Download QT Library
Also, you have to download the QT library for compile and make.
qt-win-opensource-4.7.2-mingw.exe (compiler, qmake, QT library)
http://qt.nokia.com/downloads/windows-cppWhen you ready all materials, let work it out!
Just click Next until it's done.
Install the QT library
Only have to modify the MinGW install path to QT Creator install folder.
like C:\Qt\qtcreator-2.1.0\mingw
Then just click Next until it's done.
Setup Environment Variables
Add Path
C:\Qt\4.7.2\bin
C:\Qt\qtcreator-2.1.0\mingw\bin
Add Variable
QMAKESPEC = C:\Qt\4.7.2\mkspecs\win32-g++
QTDIR = C:\Qt\4.7.2
Hello QT
Create a test.cpp file in C:\QT\Work
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("Hello world!");
hello.show();
return app.exec();
}
Execute Cmd.exe for Compile and make
Chang directory to C:\QT\Work
Execute qmake -project in command line.
Execute qmake in command line.
Execute make in command line.
Run it !
Hello QT Creator
1. Execute Qt Creator
2. Select File->New File or Project on menu.
3. Choose Qt C++ Project and Qt Gui Application then click Choose.
4. Input project name and folder location.
5. Decide the 'Main Window' class infomation, then click Next and Finish.
6. Select Debug->Start Debugging->Start Debugging on menu.
Reference:
http://blogold.chinaunix.net/u3/94212/showart_2526345.html
http://qt.nokia.com/
沒有留言:
張貼留言