红联Linux门户
Linux帮助

QT Linux下安装手册

发布时间:2008-10-14 10:11:13来源:红联作者:MONND
具体的安装办法:

1、去这里下载Qt 4.4.0 for X11 OpenSource版。

2、下载过来的是 qt-x11-opensource-src-4.4.0.tar.gz 文件,我们用tar命令解压一下。

tar zxvf qt-x11-opensource-src-4.4.0.tar.gz

3、把这个目录移到/usr/local目录下,或者不移,放在/home目录也无所谓,下面的安装过程是把这个目录移到/usr/local目录下,改名为qt,如果您没有移动,在设置的时候注意目录。

4、修改(可以使用vi编辑器或者gedit)自己目录下的.bash_profile 或者 .profile或者是/etc/profile这个文件,加入下面的代码:

QTDIR=/usr/local/qt
PATH=$QTDIR/bin:$PATH
MANPATH=$QTDIR/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QTDIR PATH MANPATH LD_LIBRARY_PATH

5、注销一下用户或者 source .bash_profile 一下,使配置文件生效。

6、进入QT的目录,开始编译

./configure

输入yes同意GPL/QPL协议。在网络上还看到这个命令 ./configure -thread,为了支持多线程,大家还是敲一下这些命令好了。(不知道./configure -thread 和 ./configure 命令有没有重复)

7、开始make 这步要一两个小时

make

8、开始install(网上的一些手册没有这步,会出现 error while loading shared libraries: libQTDesignerComponents.so4 错误,我make install一下之后,就OK了。)这步也要挺久的,大概几十分钟吧。

make install

9、进入QT的目录,进入bin目录,然后运行 ./designer,大家可以看到图形界面了吧。
文章评论

共有 3 条评论

  1. szzfq61 于 2008-12-18 16:45:00发表:

    I met the following problem when I make it , what is the reason?

    g++ -c -include .pch/release-shared/QtGui -pipe -g -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_BUILD_GUI_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DQT_RASTER_IMAGEENGINE -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DFT2_BUILD_LIBRARY -DFT_CONFIG_OPTION_SYSTEM_ZLIB -DQT_NO_OPENTYPE -DQT_NO_STYLE_MAC -DQT_NO_STYLE_WINDOWSVISTA -DQT_NO_STYLE_WINDOWSXP -DQT_NO_STYLE_WINDOWSCE -DQT_NO_STYLE_WINDOWSMOBILE -DQ_INTERNAL_QAPP_SRC -DQT_NO_DEBUG -DQT_CORE_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/linux-g++ -I. -I../../include/QtCore -I../../include/QtCore -I../../include -I../../include/QtGui -I.rcc/release-shared -I../3rdparty/libpng -I../3rdparty/zlib -I../3rdparty/freetype/src -I../3rdparty/freetype/include -I../3rdparty/freetype/builds/unix -I../3rdparty/harfbuzz/src -Idialogs -I.moc/release-shared -I/usr/X11R6/include -I.uic/release-shared -o .obj/release-shared/qapplication.o kernel/qapplication.cpp
    In file included from ../../include/QtGui/private/qt_x11_p.h:1,
    from kernel/qapplication.cpp:70:
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:65:22: error: X11/Xlib.h: No such file or directory
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:70:23: error: X11/Xutil.h: No such file or directory
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:71:21: error: X11/Xos.h: No such file or directory
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:78:23: error: X11/Xatom.h: No such file or directory
    In file included from ../../include/QtGui/private/qt_x11_p.h:1,
    from kernel/qapplication.cpp:70:
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:280: error: 'Colormap' does not name a type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:281: error: ISO C++ forbids declaration of 'Visual' with no type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:281: error: expected ';' before '*' token
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:290: error: 'Time' does not name a type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:291: error: 'Window' does not name a type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:292: error: 'Window' does not name a type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:315: error: 'Window' does not name a type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:318: error: 'Window' has not been declared
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:319: error: 'Window' has not been declared
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:319: error: 'Atom' has not been declared
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:320: error: 'Atom' has not been declared
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:321: error: 'Window' has not been declared
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:321: error: 'Atom' has not been declared
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:332: error: expected ',' or '...' before '*' token
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:332: error: ISO C++ forbids declaration of 'XSelectionRequestEvent' with no type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:334: error: 'Atom' has not been declared
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:335: error: 'Atom' does not name a type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:337: error: 'Atom' has not been declared
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:338: error: 'Atom' does not name a type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:339: error: 'Atom' has not been declared
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:340: error: 'Atom' has not been declared
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:340: error: 'Atom' has not been declared
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:341: error: 'Atom' was not declared in this scope
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:341: error: template argument 1 is invalid
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:342: error: 'Atom' has not been declared
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:343: error: 'Atom' does not name a type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:404: error: ISO C++ forbids declaration of 'Atom' with no type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:404: error: expected ';' before '*' token
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:406: error: ISO C++ forbids declaration of 'Window' with no type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:406: error: expected ';' before '*' token
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:408: error: 'Window' does not name a type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:414: error: 'Time' does not name a type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:415: error: 'Time' does not name a type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:441: error: ISO C++ forbids declaration of 'Visual' with no type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:441: error: expected ';' before '*' token
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:442: error: 'Colormap' does not name a type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:620: error: 'Atom' does not name a type
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:622: error: 'Atom' has not been declared
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:645: error: 'FocusOut' was not declared in this scope
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:646: error: 'FocusIn' was not declared in this scope
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:647: error: 'KeyPress' was not declared in this scope
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:648: error: 'KeyRelease' was not declared in this scope
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:649: error: 'None' was not declared in this scope
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:650: error: 'RevertToParent' was not declared in this scope
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:651: error: 'GrayScale' was not declared in this scope
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:652: error: 'CursorShape' was not declared in this scope
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:667: error: 'XPoint' was not declared in this scope
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:667: error: template argument 1 is invalid
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:668: error: 'XRectangle' was not declared in this scope
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:668: error: template argument 1 is invalid
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:669: error: 'XChar2b' was not declared in this scope
    ../../include/QtGui/private/../../../src/gui/kernel/qt_x11_p.h:669: error: template argument 1 is invalid
    make[1]: *** [.obj/release-shared/qapplication.o] Error 1
    make[1]: Leaving directory `/usr/local/qt/qt-x11-opensource-src-4.4.3/src/gui'
    make: *** [sub-gui-make_default-ordered] Error 2

  2. chris078426 于 2008-10-14 13:07:30发表:

    能不能找个下载库的地方,将不胜感激。(()):s