下载qt-x11-opensource-src-4.4.3,在UBUNTU的终端模式下configure,完成,make,完成,make install,完成,安装到/usr/local/Trolltech/Qt-4.4.3路径下,编辑~/.bashrc文件,添加export QTDIR=/usr/local/Trolltech/Qt-4.4.3,export PATH=/usr/local/Trolltech/Qt-4.4.3/bin:$PATH。重新启动终端,vi study1.cpp。程序源码为:
#include <qapplicatioh.h>
#include <qwidget.h>
#include <qpushbutton.h>
main( int argc, char **argv )
{
QApplication a( argc, argv );
QWidget mainwindow;
mainwindow.setMinimumSize( 200, 100 );
mainwindow.setMaximumSize( 200, 100 );
QPushButton helloworld( "Hello World!", &mainwindow );
helloworld.setGeometry( 20, 20, 160, 60 );
a.setMainWidget( &mainwindow );
mainwindow.show();
reutrn a.exec();
}
编辑完毕后,保存退出,运行g++ study1.cpp -o study1,屏幕提示无法找到头文件,请高手指点,哪里设置有问题,哪个环境变量有问题