Expected unqualified-id before 'int' with Qt5.3 only for bool signal and slot



  • I have some code that compile and works correctly on Windows but when I try to compile it on linux with scons I get this error on the generated moc files.
    The moc files are created with Qt 5.3 (I checked that they are accidently created by an older Qt version that is also installed, which means my QTDIR, QTLIB & QTINC are defined correctly) and the signal/slot tables look correct and nothing strange about them except that the line:
    QMetaType::Void, QMetaType::Bool, 3,
    for a slot or signal generate an error. The type "QMetaType::Bool" is not identified by the g++ compiler for some reason
    Any idea what can be causing this?



  • The problem is because of the xlib.h which defines Bool
    The solution is after all the includes do #undef Bool

    #include <Qt stuff>
    #include <you stuff that include xlib.h>

    #undef Bool

    class
    {
    }

    This is ugly but so far this is the only solution I found. This will cause the need to include files in the .cpp in a specific order sometimes since in some cases you'll need the Bool as defined in the xlib.h


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.