• 4772阅读
  • 4回复

QT程序出错,望高人指点 [复制链接]

上一主题 下一主题
离线leiyuhong
 

只看楼主 倒序阅读 楼主  发表于: 2007-03-29
我在LINUX系统下装了QT3,我编译了个简单的程序:
#include <qapplication.h>
#include <qwidget.h>
#include <qpushbutton.h>

int main(int argc,char **argv)

{

  QApplication a( argc,argv );
  QWidget mainwindow;
  mainwindow.setMinimumSize( 200,100 );
  mainwindow.setMaximumSize( 200,100 );
 
  QPushButton helloworld( "hello world!",&mainwoindow );
  helloworld.SetGeometry( 20,20,160,60 );

  a.setMainWidget( &mainwindow );
  mainwindow.show();
  return a.exec();

}
但是出现如下的错误:
world.cpp:1:26: error: qapplication.h: No such file or directory
world.cpp:2:21: error: qwidget.h: No such file or directory
world.cpp:3:25: error: qpushbutton.h: No such file or directory
world.cpp: In function ‘int main(int, char**)’:
world.cpp:9: error: ‘QApplication’ was not declared in this scope
world.cpp:9: error: expected `;' before ‘a’
world.cpp:10: error: ‘QWidget’ was not declared in this scope
world.cpp:10: error: expected `;' before ‘mainwindow’
world.cpp:11: error: ‘mainwindow’ was not declared in this scope
world.cpp:14: error: ‘QPushButton’ was not declared in this scope
world.cpp:14: error: expected `;' before ‘helloworld’
world.cpp:15: error: ‘helloworld’ was not declared in this scope
world.cpp:17: error: ‘a’ was not declared in this scope
我在想是不是什么函数库没有装上?
离线leiyuhong

只看该作者 1楼 发表于: 2007-03-29
我都检查了好长时间的错误,没有找到原因,刚刚学习QT,希望大家指点一下
离线dujianghua
只看该作者 2楼 发表于: 2007-03-30
这个提示说明系统没有找到文件,你看看你的QTDIR,那几个是否正确.如果真确看qapplication.h在不在QTDIR/include里面
离线monkey888
只看该作者 3楼 发表于: 2007-04-14
编译环境设置有问题!察看trolltech官方网站的编译方法!
离线leiyuhong

只看该作者 4楼 发表于: 2007-04-17
谢谢大家的指点
快速回复
限100 字节
 
上一个 下一个