一个关于QT的基本问题
我刚安装了QT4.6.0,设置好了环境变量,打算在codeblocks用qmake编译一个简单的hello world程序,但出现以下错误:
程序如下,是在书上直接打上去的:
另外说说,环境变量那里path、include和lib都设置好的。我只安装了一个版本的QT。另外,我在网上找到了一些方法,好像在include那里加上Qt/之类的方法,都不行。
请问会是什么原因呢?谢谢。
d:\My Documents\new\qtdemo\qtdemo.cpp|1|QApplication: No such file or directory|
d:\My Documents\new\qtdemo\qtdemo.cpp|2|QPushButton: No such file or directory|
d:\My Documents\new\qtdemo\qtdemo.cpp||In function `int main(int, char**)':|
d:\My Documents\new\qtdemo\qtdemo.cpp|6|error: `QApplication' was not declared in this scope|
d:\My Documents\new\qtdemo\qtdemo.cpp|6|error: expected `;' before "app"|
d:\My Documents\new\qtdemo\qtdemo.cpp|7|error: `QPushButton' was not declared in this scope|
d:\My Documents\new\qtdemo\qtdemo.cpp|7|error: expected `;' before "hello"|
d:\My Documents\new\qtdemo\qtdemo.cpp|8|error: `hello' was not declared in this scope|
d:\My Documents\new\qtdemo\qtdemo.cpp|10|error: `app' was not declared in this scope|
d:\My Documents\new\qtdemo\qtdemo.cpp|6|warning: unused variable 'QApplication'|
d:\My Documents\new\qtdemo\qtdemo.cpp|7|warning: unused variable 'QPushButton'|
d:\My Documents\new\qtdemo\qtdemo.cpp|10|warning: unused variable 'app'|
||=== Build finished: 8 errors, 3 warnings ===|
程序如下,是在书上直接打上去的:
#include <QApplication>
#include <QPushButton>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QPushButton hello("Hello world!");
hello.resize(100, 30);
hello.show();
return app.exec();
}另外说说,环境变量那里path、include和lib都设置好的。我只安装了一个版本的QT。另外,我在网上找到了一些方法,好像在include那里加上Qt/之类的方法,都不行。
请问会是什么原因呢?谢谢。
...全文
相关推荐
优质Qt资源,Qt编写的一些开源的demo(100个以上),支持Qt4、Qt5、Qt6,支持任意系统
Qt是一个强大的跨平台应用程序开发框架,广泛用于创建GUI(图形用户界面)应用程序,同时也支持命令行界面和无界面的后台服务。
在QT下使用递归生成二叉树
在QT框架下,使用递归生成二叉树是一种常见的图形用户界面(GUI)编程技术,尤其适用于构建数据结构可视化工具。QT是一个强大的跨平台应用程序开发框架,支持多种操作系统,包括Windows。
QT入门之qt软件安装指南
**安装路径**:选择一个合适的目录来存放Qt安装文件,建议避免使用默认的Program Files目录,以防权限问题。2. **组件选择**:这是安装过程中最重要的部分。
qt4 显示一个jpg图片
在IT领域,Qt是一个非常流行的跨平台应用程序开发框架,它由Qt公司开发并维护,支持C++和QML等编程语言。
QT的基本使用与开发
QT是一种流行的开源跨平台应用程序开发框架,主要应用于GUI(图形用户界面)编程,但也可用于非GUI项目。


工具平台和程序库
