gmake install 完后,可 执行 make clean将中间生成的许多.o文件清楚,这些临时文件要占很大一部分空间。
编译出错:
In file included from kernel/qt_x11.h:76,
from kernel/qpsprinter.cpp:97:
/usr/X11R6/include/X11/Xft/Xft.h:35:31:
freetype/freetype.h: No such file or directory
In file included from kernel/qt_x11.h:76,
from kernel/qpsprinter.cpp:97:
/usr/X11R6/include/X11/Xft/Xft.h:52: syntax error
before `;' token
/usr/X11R6/include/X11/Xft/Xft.h:86: 'FT_UInt' is used
as a type, but is not
defined as a type.
/usr/X11R6/include/X11/Xft/Xft.h:93: 'FT_UInt' is used
as a type, but is not
defined as a type.
/usr/X11R6/include/X11/Xft/Xft.h:190: parse error
before `*' token
/usr/X11R6/include/X11/Xft/Xft.h:295: parse error
before `*' token
/usr/X11R6/include/X11/Xft/Xft.h:354: parse error
before `*' token
/usr/X11R6/include/X11/Xft/Xft.h:393: parse error
before `*' token
/usr/X11R6/include/X11/Xft/Xft.h:399: parse error
before `*' token
/usr/X11R6/include/X11/Xft/Xft.h:408: type specifier
omitted for parameter `
FT_UInt'
/usr/X11R6/include/X11/Xft/Xft.h:408: parse error
before `,' token
/usr/X11R6/include/X11/Xft/Xft.h:418: parse error
before `*' token
/usr/X11R6/include/X11/Xft/Xft.h:461: parse error
before `*' token
make[2]: *** [kernel/qpsprinter.o] Error 1
make[2]: Leaving directory `/home/qt-2.3.2/src'
make[1]: *** [sub-src] Error 2
make[1]: Leaving directory `/home/qt-2.3.2'
make: *** [init] Error 2
解决方法:
cd /usr/include
ln -s freetype2/freetype freetype
首先我们进入Linux的图形界面,打开一个控制终端(在桌面空间处单击鼠标右键,在弹出的单菜中选择“新建控制终端”。),在控制终端里面新建一个.cpp文件,并编写程序,如下:
#vi HelloWorld.cpp //建立一个HelloWorld.cpp文件
#include<qapplication.h>
#include<qlabel.h>
int main(int argc,char *argv[])
{
QApplication app(argc,argv);
QLabel *label=new QLabel("Hello World!!!",0);
app.setMainWidget(label);
label->show();
return app.exec();
}
写完上面的代码后保存退出(wq)vi编辑器。
#qmake -project //把.cpp文件编译成.pro文件
#qmake HelloWorld.pro //通过.pro文件自动创建Makefile文件
#make //编译,生成HelloWorld执行文件
#./HelloWorld //运行HelloWorld文件
程序正常运行对话框显示“HelloWorld!!!”,证明Qt安装成功!!
联系客服