搜档网
当前位置:搜档网 › windows下安装QT

windows下安装QT

1,先去下载IDE

打开网页:https://www.sodocs.net/doc/ba1582123.html,/downloads/qt-creator-binary-for-windows

下载文件:qt-creator-win-opensource-2.3.1.exe

详细连接:https://www.sodocs.net/doc/ba1582123.html,/qtcreator/qt-creator-win-opensource-2.3.1.exe

安装目录:C:\Qt\qtcreator-2.3.1

2,再去下载QT库

打开网页:https://www.sodocs.net/doc/ba1582123.html,/downloads/windows-cpp

下载文件:qt-win-opensource-4.7.4-mingw.exe

详细连接:https://www.sodocs.net/doc/ba1582123.html,/qt/source/qt-win-opensource-4.7.4-mingw.exe

安装目录:C:\Qt\4.7.4

安装过程询问MinGW编译器时填写目录:C:\Qt\qtcreator-2.3.1\mingw

(MinGW下载:https://www.sodocs.net/doc/ba1582123.html,/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库路径)

新建两个系统变量:

1QTDIT: C:\Qt\4.7.3

2QMAKESPE: C:\win32-g++ 添加

设置完这些打开IDE就可以编写程序了,不过这个编写出来的程序是动态库的,

如果想要静态库的,就要另外重新编译静态库才行了。

4,建立源码工程

在D:\works\9G-CM0\qt\hello中建立文件:hello.cpp

内容如下:

#include

#include

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

相关主题