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. Ubuntu 12.04/Qt 4.7.2 -> qnamespace.h:1650:33: error: expected unqualified-id before ‘;’ token

Ubuntu 12.04/Qt 4.7.2 -> qnamespace.h:1650:33: error: expected unqualified-id before ‘;’ token

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 4.0k Views
  • 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.
  • B Offline
    B Offline
    bsampson
    wrote on last edited by
    #1

    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]

    1 Reply Last reply
    0
    • G Offline
      G Offline
      guziemic
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bsampson
        wrote on last edited by
        #3

        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;@

        1 Reply Last reply
        0
        • F Offline
          F Offline
          foxyz
          wrote on last edited by
          #4

          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 just know coding and coding

          1 Reply Last reply
          0
          • F Offline
            F Offline
            foxyz
            wrote on last edited by
            #5

            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"

            I just know coding and coding

            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