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