LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 842|回复: 0

Qt hello,world出错(解决)

[复制链接]
发表于 2007-4-6 10:08:51 | 显示全部楼层 |阅读模式

  1. #include <qapplication.h>
  2. #include <qpushbutton.h>


  3. int main( int argc, char **argv )
  4. {
  5.     QApplication a( argc, argv );

  6.     QPushButton hello( "Hello world!", 0 );
  7.     hello.resize( 100, 30 );

  8.     a.setMainWidget( &hello );
  9.     hello.show();
  10.     return a.exec();
  11. }
复制代码


[root@buffee ~]# qmake -project /root/qt_program/main.cpp
[root@buffee ~]# qmake /root/qt_program/main.cpp
/root/qt_program/main.cpp:5: Unknown test function: int main
/root/qt_program/main.cpp:7: Unknown test function: QApplication a
/root/qt_program/main.cpp:7: Parse Error ('QApplication a( argc, argv );')
/root/qt_program/main.cpp:7: Unterminated conditional block at end of file
Error processing project file: /root/qt_program/main.cpp
不知道什么原因

ps:
qmake等命令必须到Qt-4.2.2的安装目录下才能执行,可能是./configure的时候没有
设置environment variables
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表