Tag Archives: XCB Generic

[Solved] error: ‘xcb_generic_event_t’ was not declared in this scope

code:

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;
}

Tag Page: /home/test/Downloads/tray/tray/tray.cpp:244: error: unknown type name ‘xcb_generic_event_t’
Outcome:
../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
Solution: #include <xcb/xcb.h>
Reference: https://codesearch.isocpp.org/actcd19/main/c/clementine/clementine_1.3.1+git609-g623a53681+dfsg-1/3rdparty/qxt/qxtglobalshortcut_x11.cpp