1,先去下载IDE
打开网页:http://qt.nokia.com/downloads/qt-creator-binary-for-windows 下载文件:qt-creator-win-opensource-2.3.1.exe
详细连接:http://get.qt.nokia.com/qtcreator/qt-creator-win-opensource-2.3.1.exe 安装目录:C:\Qt\qtcreator-2.3.1 2,再去下载QT库
打开网页:http://qt.nokia.com/downloads/windows-cpp 下载文件:qt-win-opensource-4.7.4-mingw.exe
详细连接:http://get.qt.nokia.com/qt/source/qt-win-opensource-4.7.4-mingw.exe 安装目录:C:\Qt\4.7.4
安装过程询问MinGW编译器时填写目录:C:\Qt\qtcreator-2.3.1\mingw
(MinGW下载:http://get.qt.nokia.com/misc/MinGW-gcc440_1.zip,如果需要可单独安装) 3,添加系统环境变量 加入三个路径:
C:\Qt\qtcreator-2.3.1\mingw\bin (IDE下mingw编译器路径) C:\Qt\4.7.4\bin (QT库qmake路径) C:\Qt\4.7.4\qmake (QT库qmake库路径)
新建两个系统变量:
QTDIT: C:\Qt\4.7.3
QMAKESPE: C:\win32-g++
设置完这些打开IDE就可以编写程序了,不过这个编写出来的程序是动态库的, 如果想要静态库的,就要另外重新编译静态库才行了。 4,建立源码工程
在D:\works\9G-CM0\qt\hello中建立文件:hello.cpp 内容如下:
#include <QApplication> #include <QTextEdit> int main(int argv, char **args) {
QApplication app(argv, args); QTextEdit textEdit; textEdit.show(); return app.exec(); }
5,建立工程配置
打开启动菜单的Qt by Nokia v4.7.4 (MinGW OpenSource)下的Qt 4.7.4 Command Prompt, 进入到目录:D:\works\9G-CM0\qt\hello 运行:qmake -project hello.cpp qmake make 6,运行程序
打开:D:\works\9G-CM0\qt\hello\debug
双击:hello.exe