Ubuntu 12.04/Qt 4.7.2 -> qnamespace.h:1650:33: error: expected unqualified-id before ‘;’ token
-
Any idea why I would be getting the following error when I try to build a project:
@
In file included from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qobjectdefs.h:27:0,
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qobject.h:29,
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/QObject:1,
from ../../Notifier.h:16,
from ../../Provider.h:16,
from ../../Provider.cpp:16:
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qnamespace.h:1650:33: error: expected unqualified-id before ‘;’ token
@
If I look at the qnamespace.h file, this is the code it is choking on:
@
#if defined(Q_WS_MAC)
typedef void * HANDLE;
#elif defined(Q_WS_WIN)
typedef void *HANDLE;
#elif defined(Q_WS_X11)
typedef unsigned long HANDLE; //line 1650
#elif defined(Q_WS_QWS)
typedef void * HANDLE;
#elif defined(Q_OS_SYMBIAN)
typedef unsigned long int HANDLE; // equivalent to TUint32
#endif
typedef WindowFlags WFlags;
@
My gcc version 4.6.3.[Edit: Added @ tags -- mlong]
-
I think that without more details, for instance part of file where error starts (Provider.cpp) it will be hard to find problem.
And by the way if you put code please surround it with '@ @ marks. It will be easier to read it.
-
Thanks for the code posting tip.
I guess I assume it is an issue with my environment since the error is originates in the Qt code, AND I should have mentioned that coworkers can compile the same code on their Ubuntu 10.04 workstations, and 1 coworker running 12.04 also doesn't have any issues. It's a relatively large project, so posting all the code isn't feasible. I'm on the verge of reformatting/rebuilding my machine, but I thought I'd try the forum first. I'm pretty new to Qt and c++, so I'm hoping somebody else may have seen it themselves.
Any tips on things I should check? I did find the Qt 4.7 x11 prerequisites, and my machine has all mentioned packages installed.
@In file included from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qobjectdefs.h:27:0,
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/qobject.h:29,
from /usr/local/Trolltech/Qt-4.7.2/include/QtCore/QObject:1,
from ../../src1/Notifier.h:16,
from ../../src1/Provider.h:16,
from ../../src1/Provider.cpp:16:
/usr/local/Trolltech/Qt-4.7.2/include/QtCore/qnamespace.h:1650:33: error: expected unqualified-id before ‘;’ token@Line 16 chunk from Provider.cpp:
@#include "Provider.h" //LINE 16@Line 16 portion of Provider.h:
@#include "Notifier.h" //LINE 16@Line 16 portion from Notifier.h:
@#include <QObject> //LINE 16@And here is the code from the qnamespace.h file:
@#if defined(Q_WS_MAC) typedef void * HANDLE;
#elif defined(Q_WS_WIN) typedef void *HANDLE;
#elif defined(Q_WS_X11) typedef unsigned long HANDLE; //line 1650
#elif defined(Q_WS_QWS) typedef void * HANDLE;
#elif defined(Q_OS_SYMBIAN) typedef unsigned long int HANDLE; // equivalent to TUint32
#endif typedef WindowFlags WFlags;@ -
Usually, This is because Macro-definied "ItemIsEnabled" conflict with the enum item "ItemFlag" orn something. This problem occurs when you include some None-Qt header files and in a wrong sequence
One method is undef ItemIsEnabled -
I once got some issues very similar as this. I adjusted the header files including sequence and before including Qt header files I #undef all conflicted macro-defines. In my case, the conflicted item is "CursorShape"