Compilation issues on Linux

  • Hi,
    I have a strange issue on Linux if I tried to build an app including a event filter and which has X11 libraries included.
    Part of code:
    bool MainWindow::eventFilter(QObject *object, QEvent event)
    if (object == ui.channelsWidget && event->type() == QEvent::KeyPress)
    item = ui.channelsWidget->currentItem();
    QKeyEvent *keyEvent = static_cast<QKeyEvent >(event);
    if (keyEvent->key() == Qt::Key_Right)
    return true;
    return false;
    return false;
    void ChannelsTree::filterExpand(QTreeWidgetItem
    if((item->type() & CHANNEL_TYPE) && !item->isExpanded())

    When I build on Linux:
    mainwindow.cpp:6208:65: error: expected unqualified-id before numeric constant
    if (object == ui.channelsWidget && event->type() == QEvent::KeyPress)
    mainwindow.cpp:6208:63: error: expected ‘)’ before numeric constant
    if (object == ui.channelsWidget && event->type() == QEvent::KeyPress)
    ~ ^
    X11 libraries are includes as follow:
    #include <QX11Info>
    #include <X11/Xlib.h>
    #include <X11/Xutil.h>
    I have no error on Windows.
    Have you an idea to fix it?

  • Lifetime Qt Champion

    Don't include the x11 headers - or why do you need them?
    If you really need them then one of the names in the affected line is a define in the included x11 headers - undefine it


    6208 ? wtf...

  • @Oreonan said in Compilation issues on Linux:

    error: expected ‘)’ before numeric constant

    This is a pretty big class. Can you check if there is any line ending issue in your code?
    Display endings of all lines in your editor.

  • Hi and thanks for your answers,
    I need this X11 libraries to use some specific functions on Linux.
    My file haven't any end line issue apparently.
    How can I find what make problem on X11 headers and undefine it?

  • I just moved my code to another file which not include X11 headers and it's working now.

Log in to reply