Odd error with headers
Solved
General and Desktop
-
GCC give me errors:
In file included from /usr/include/X11/Xlib.h:44, from /home/andrzej/wazne/proj/minimal_odd_conflict/Win.h:4, from /home/andrzej/wazne/proj/minimal_odd_conflict/Win.cpp:1: /usr/include/x86_64-linux-gnu/qt5/QtCore/qnamespace.h:1199:10: error: expected identifier before numeric constant 1199 | enum CursorShape {
although Xlib.h doesn't include qnamespace.h
Preprocessor only (make make Win.cpp.i) is usual
This is not GCC error, because error is also in Clang, although errors is clearer than GCC - about MOCIn file included from /home/andrzej/wazne/proj/minimal_odd_conflict/Win.cpp:2: In file included from /home/andrzej/wazne/proj/minimal_odd_conflict/EdiException.h:7: In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/QString:1: In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:50: In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:45: /usr/include/x86_64-linux-gnu/qt5/QtCore/qnamespace.h:1199:10: error: expected identifier or '{' enum CursorShape {
I attach minimal project minimal_odd_conflict.zip
Solution:
is enough in Win.cpp#include "Win.h" #undef CursorShape #include "EdiException.h"
-
X11/X.h contains something like '#define CursorShape 0', which conflicts with the Qt header trying to declare CursorShape as an enum.
This can be solved by making sure Qt headers are included first, and then only system headers.