其他分享
首页 > 其他分享> > error: ‘xcb_generic_event_t’ was not declared in this scope

error: ‘xcb_generic_event_t’ was not declared in this scope

作者:互联网

代码:

bool tray::nativeEventFilter(const QByteArray &eventType, void *message, long *)
{
    qDebug("tray::nativeEventFilter:%s\n", eventType.data());
    if (eventType == "xcb_generic_event_t") {
        xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
        // ...
    }
    return false;
}

问题标签页:/home/test/Downloads/tray/tray/tray.cpp:244: error: unknown type name 'xcb_generic_event_t'

输出窗口:

../tray/tray.cpp:244:9: error: ‘xcb_generic_event_t’ was not declared in this scope
         xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
         ^~~~~~~~~~~~~~~~~~~
../tray/tray.cpp:244:9: note: suggested alternative: ‘xGenericEvent’
         xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
         ^~~~~~~~~~~~~~~~~~~
         xGenericEvent

解决:#include <xcb/xcb.h>

标签:xcb,declared,generic,eventType,message,tray,event
来源: https://blog.csdn.net/dragoo1/article/details/121536039