标题:我编译QT4的一个HELLO例子无法通过!!错误如下,如何解决!
作者:hsly110
日期:2006-08-29 21:17
内容:
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: *** 错误 1
#include
#include
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("Hello world!");
hello.resize(100, 30);
hello.show();
return app.exec();
}
#1 [ediwon 08-29 23:05]
环境变量没有配置好
#2 [hsly110 08-30 00:41]
呵呵,问题解决了。
我的 qmake 的版本是3。0 版本的。
应该用4。0版本的。
上面那个应该是QT4的例子了。
我用qmake-qt4 版本就可以编译了。呵呵 ~
好菜鸟哦~~~