qt之库编译错误:qxcbkeyboard.cpp:(.text+0x25c):对‘QXkbCommon::xxxxxx(xxx)’未定义的引用

本文详细解析了在Qt构建过程中遇到的与Xcb相关的编译错误,特别是未定义引用错误,如QXkbCommon函数的问题。文章提供了具体的错误信息,并指出此问题源于Qt的Xcb支持未被正确启用。最后,给出了明确的解决步骤,即在configure阶段添加-qt-xcb选项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误描述

.obj/qxcbkeyboard.o:在函数‘QXcbKeyboard::possibleKeys(QKeyEvent const*) const’中:
qxcbkeyboard.cpp:(.text+0x25c):对‘QXkbCommon::possibleKeys(xkb_state*, QKeyEvent const*, bool, bool)’未定义的引用
.obj/qxcbkeyboard.o:在函数‘QXcbKeyboard::updateKeymap()’中:
qxcbkeyboard.cpp:(.text+0x1876):对‘QXkbCommon::verifyHasLatinLayout(xkb_keymap*)’未定义的引用
.obj/qxcbkeyboard.o:在函数‘QXcbKeyboard::handleKeyEvent(unsigned int, QEvent::Type, unsigned char, unsigned short, unsigned int, bool)’中:
qxcbkeyboard.cpp:(.text+0x1c9e):对‘QXkbCommon::lookupString(xkb_state*, unsigned int)’未定义的引用
qxcbkeyboard.cpp:(.text+0x1ce0):对‘QXkbCommon::keysymToQtKey(unsigned int, QFlags<Qt::KeyboardModifier>, xkb_state*, unsigned int, bool, bool)’未定义的引用
.obj/qxcbkeyboard.o:在函数‘QXcbKeyboard::initialize()’中:
qxcbkeyboard.cpp:(.text+0x5a0):对‘QXkbCommon::setXkbContext(QPlatformInputContext*, xkb_context*)’未定义的引用
collect2: error: ld returned 1 exit status
Makefile.xcb_qpa_lib:238: recipe for target '../../../../lib/libQt5XcbQpa.so.5.14.1' failed
make[6]: *** [../../../../lib/libQt5XcbQpa.so.5.14.1] Error 1
make[6]: Leaving directory '/home/jaron/software/qt-build/qtbase/src/plugins/platforms/xcb'
Makefile:90: recipe for target 'sub-xcb_qpa_lib-pro-make_first-ordered' failed
make[5]: *** [sub-xcb_qpa_lib-pro-make_first-ordered] Error 2
make[5]: Leaving directory '/home/jaron/software/qt-build/qtbase/src/plugins/platforms/xcb'
Makefile:102: recipe for target 'sub-xcb-make_first' failed
make[4]: *** [sub-xcb-make_first] Error 2
make[4]: Leaving directory '/home/jaron/software/qt-build/qtbase/src/plugins/platforms'
Makefile:104: recipe for target 'sub-platforms-make_first' failed
make[3]: *** [sub-platforms-make_first] Error 2
make[3]: Leaving directory '/home/jaron/software/qt-build/qtbase/src/plugins'
Makefile:723: recipe for target 'sub-plugins-make_first' failed
make[2]: *** [sub-plugins-make_first] Error 2
make[2]: Leaving directory '/home/jaron/software/qt-build/qtbase/src'
Makefile:50: recipe for target 'sub-src-make_first' failed
make[1]: *** [sub-src-make_first] Error 2
make[1]: Leaving directory '/home/jaron/software/qt-build/qtbase'
Makefile:87: recipe for target 'module-qtbase-make_first' failed
make: *** [module-qtbase-make_first] Error 2

错误原因

        这是由于未启用qt自带的xcb。

解决方法

        在configure的时候加上配置选项-qt-xcb

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值