1.下载安装包
注意:在安装过程中需要选定编译器,如果你电脑没有需下载安装mingw
2.配置mingw
3.测试qt开发环境是否安装成功
1、把如下的程序拷贝到文件“hello.cpp”中:
#include <QApplication> #include <QLabel> int main(int argc, char *argv[]) { QApplication app(argc, argv); QLabel *label = new QLabel("Hello Qt!"); label->show(); return app.exec(); } |
2、将文件“hello.cpp”保存在目录“D:\Qt”下(根据实际情况选择目录)
3、选择“Qt 4.1.4 Command Prompt”,进入命令行界面,进入刚才保存“hello.cpp”的目录(主要用DOC命令:D:\Qt )
4、在命令提示符后面,分别输入:
qmake -project
(to create a platform-independent project file (hello.pro))
qmake QT.pro
(to create a platform-specific makefile from the project file)
make
(to build the program)
5、经过以上三个步骤以后,在“hello.cpp”所在的目录下,得到以下一系列文件:
6 、在这个目录下面的“ release ”文件夹下面,得到一个 windows 下面的可执行程序“QT .exe ” :
4.配置qt creator
Qt Creator打开后可以看到主界面
在主界面中从菜单栏点击"工具"->"选项"->在左侧点击“构建和运行”界面如下图所示。
手动添加编译器g++和调试器gdb,它们两个分别在安装的mingw目录下的bin文件夹中,添加它们的绝对路径