编译Qt-Everywhere 4.6.3时对xlib.h中函数的未定义引用

时间:2013-09-04 05:33:56

标签: qt compilation linker g++

我在Ubuntu 12.04.1 32bit上编译Qt-Everywhere 4.6.3,用于mini2440。我能够为mini2440编译qmake但无法编译我的笔记本电脑进行测试。 ./configure没有给我任何错误(我必须安装libx11-dev& libXext-dev才能这样做。但是在运行make时,我遇到了许多链接器错误,如:

.obj/release-shared/qpaintengine_x11.o: In function `QX11PaintEngine::drawPixmap(QRectF const&, QPixmap const&, QRectF const&)':
qpaintengine_x11.cpp:(.text+0x25fb): undefined reference to `XCopyArea'
qpaintengine_x11.cpp:(.text+0x264c): undefined reference to `XSetClipOrigin'
qpaintengine_x11.cpp:(.text+0x2691): undefined reference to `XSetClipMask'
qpaintengine_x11.cpp:(.text+0x2723): undefined reference to `XCopyArea'
qpaintengine_x11.cpp:(.text+0x2871): undefined reference to `XSetClipRectangles'
qpaintengine_x11.cpp:(.text+0x28bf): undefined reference to `XCreatePixmap'
qpaintengine_x11.cpp:(.text+0x28e2): undefined reference to `XCreateGC'
qpaintengine_x11.cpp:(.text+0x28fd): undefined reference to `XSetForeground'
qpaintengine_x11.cpp:(.text+0x2934): undefined reference to `XFillRectangle'
qpaintengine_x11.cpp:(.text+0x2989): undefined reference to `XSetClipRectangles'
qpaintengine_x11.cpp:(.text+0x29dc): undefined reference to `XCopyArea'
qpaintengine_x11.cpp:(.text+0x29ef): undefined reference to `XFreeGC'
qpaintengine_x11.cpp:(.text+0x2a0c): undefined reference to `XSetClipMask'
qpaintengine_x11.cpp:(.text+0x2a31): undefined reference to `XSetClipOrigin'
qpaintengine_x11.cpp:(.text+0x2a44): undefined reference to `XFreePixmap'
qpaintengine_x11.cpp:(.text+0x2ab4): undefined reference to `XSetForeground'
qpaintengine_x11.cpp:(.text+0x2b16): undefined reference to `XCreateGC'
qpaintengine_x11.cpp:(.text+0x2b31): undefined reference to `XSetForeground'
qpaintengine_x11.cpp:(.text+0x2b70): undefined reference to `XFillRectangle'
qpaintengine_x11.cpp:(.text+0x2b8b): undefined reference to `XSetBackground'
qpaintengine_x11.cpp:(.text+0x2ba6): undefined reference to `XSetForeground'
qpaintengine_x11.cpp:(.text+0x2be8): undefined reference to `XSetFillStyle'
qpaintengine_x11.cpp:(.text+0x2c0f): undefined reference to `XSetTSOrigin'
qpaintengine_x11.cpp:(.text+0x2c30): undefined reference to `XSetStipple'
qpaintengine_x11.cpp:(.text+0x2c6f): undefined reference to `XFillRectangle'
qpaintengine_x11.cpp:(.text+0x2c82): undefined reference to `XFreeGC'
qpaintengine_x11.cpp:(.text+0x2ca7): undefined reference to `XSetClipOrigin'
qpaintengine_x11.cpp:(.text+0x2ccc): undefined reference to `XSetClipMask'
qpaintengine_x11.cpp:(.text+0x2d26): undefined reference to `XCreateGC'
qpaintengine_x11.cpp:(.text+0x2d51): undefined reference to `XSetBackground'
qpaintengine_x11.cpp:(.text+0x2d6c): undefined reference to `XSetForeground'
qpaintengine_x11.cpp:(.text+0x2da3): undefined reference to `XFillRectangle'
qpaintengine_x11.cpp:(.text+0x2db6): undefined reference to `XFreeGC'
qpaintengine_x11.cpp:(.text+0x2ddd): undefined reference to `XSetClipMask'
qpaintengine_x11.cpp:(.text+0x2e0a): undefined reference to `XSetClipOrigin'
qpaintengine_x11.cpp:(.text+0x2e81): undefined reference to `XSetForeground'
qpaintengine_x11.cpp:(.text+0x2ebc): undefined reference to `XFillRectangle'
qpaintengine_x11.cpp:(.text+0x2f07): undefined reference to `XSetClipRectangles'
qpaintengine_x11.cpp:(.text+0x2fa3): undefined reference to `XCopyArea'

我不知道出了什么问题。我的配置选项是:

  

ved @ ubuntu:〜/ qt-src / qt-everywhere-opensource-src-4.6.3 $ ./configure -prefix / qt-test -release -shared -fast -pch -no-qt3support -qt-sql -sqlite -no-libtiff -no-libmng -qt-libjpeg -qt-zlib -qt-libpng -qt-freetype -no-openssl -nomake examples -nomake demos -nomake tools -optimized-qmake -no-phonon -no- nis -no-opengl -no-cups -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-xkb -no-sm -no-xinerama -no-xshape -no-separate-debug-info - 深度16 -no-qvfb -qt-gfx-linuxfb -no-gfx-qvfb -no-kbd-qvfb -no-mouse-qvfb-qt-kbd-usb -confirm-license -verbose

我复制了与mini2440版本相同的选项(-xplatform qws/linux-arm-g++& -embedded arm除外)。

1 个答案:

答案 0 :(得分:0)

如果您使用的是桌面Linux发行版,请按照x11 requirements page上的说明进行操作。除了libx11-dev&您需要libXext-dev:

  • libfontconfig1-dev的
  • libfreetype6-dev的
  • libxcursor-dev的
  • libxfixes-dev的
  • libxft-dev的
  • libxi-dev的
  • libxrandr-dev的
  • libxrender-dev的