• 4290阅读
  • 2回复

我编译QT4的一个HELLO 例子无法通过!!错误如下,如何解决! [复制链接]

上一主题 下一主题
离线hsly110
 
只看楼主 倒序阅读 楼主  发表于: 2006-08-29
qt_main.cpp:1:24: error: QApplication: No such file or directory
qt_main.cpp:2:23: error: QPushButton: No such file or directory
qt_main.cpp:13:3: warning: no newline at end of file
qt_main.cpp: In function ‘int main(int, char**)’:
qt_main.cpp:6: 错误: ‘QApplication’ 在此作用域中尚未声明
qt_main.cpp:6: 错误: expected `;' before ‘app’
qt_main.cpp:8: 错误: ‘QPushButton’ 在此作用域中尚未声明
qt_main.cpp:8: 错误: expected `;' before ‘hello’
qt_main.cpp:9: 错误: ‘hello’ 在此作用域中尚未声明
qt_main.cpp:12: 错误: ‘app’ 在此作用域中尚未声明
qt_main.cpp: At global scope:
qt_main.cpp:4: 警告: 未使用的形参 ‘argc’
qt_main.cpp:4: 警告: 未使用的形参 ‘argv’
make: *** [qt_main.o] 错误 1


#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();
}
[ 此贴被XChinux在2006-08-30 08:42重新编辑 ]
离线ediwon
只看该作者 1楼 发表于: 2006-08-29
环境变量没有配置好
BLOG:
http://www.ediwon.com
-------------------------------
离线hsly110
只看该作者 2楼 发表于: 2006-08-30
呵呵,问题解决了。
我的 qmake 的版本是3。0 版本的。

应该用4。0版本的。
上面那个应该是QT4的例子了。

我用qmake-qt4 版本就可以编译了。呵呵 ~

好菜鸟哦~~~
快速回复
限100 字节
 
上一个 下一个