Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Compilation issues on Linux
Qt 6.11 is out! See what's new in the release blog

Compilation issues on Linux

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 749 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Oreonan
    wrote on last edited by
    #1

    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:
    ui.channelsWidget->installEventFilter(this);
    bool MainWindow::eventFilter(QObject *object, QEvent event)
    {
    if (object == ui.channelsWidget && event->type() == QEvent::KeyPress)
    {
    QTreeWidgetItem
    item = ui.channelsWidget->currentItem();
    QKeyEvent *keyEvent = static_cast<QKeyEvent >(event);
    if (keyEvent->key() == Qt::Key_Right)
    {
    ui.channelsWidget->filterExpand(item);
    return true;
    }
    else
    return false;
    }
    return false;
    }
    void ChannelsTree::filterExpand(QTreeWidgetItem
    item)
    {
    if((item->type() & CHANNEL_TYPE) && !item->isExpanded())
    item->setExpanded(true);
    }

    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?
    Thanks.

    JoeCFDJ 1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      mainwindow.cpp:6208

      6208 ? wtf...

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      3
      • O Oreonan

        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:
        ui.channelsWidget->installEventFilter(this);
        bool MainWindow::eventFilter(QObject *object, QEvent event)
        {
        if (object == ui.channelsWidget && event->type() == QEvent::KeyPress)
        {
        QTreeWidgetItem
        item = ui.channelsWidget->currentItem();
        QKeyEvent *keyEvent = static_cast<QKeyEvent >(event);
        if (keyEvent->key() == Qt::Key_Right)
        {
        ui.channelsWidget->filterExpand(item);
        return true;
        }
        else
        return false;
        }
        return false;
        }
        void ChannelsTree::filterExpand(QTreeWidgetItem
        item)
        {
        if((item->type() & CHANNEL_TYPE) && !item->isExpanded())
        item->setExpanded(true);
        }

        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?
        Thanks.

        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by JoeCFD
        #3

        @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.
        https://superuser.com/questions/374028/how-are-n-and-r-handled-differently-on-linux-and-windows

        1 Reply Last reply
        0
        • O Offline
          O Offline
          Oreonan
          wrote on last edited by
          #4

          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?

          1 Reply Last reply
          0
          • O Offline
            O Offline
            Oreonan
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved