[SOLVED] QT_DEPRECATED_SINCE gives error "missing binary operator before token (" in qnamespace.h



  • Hi,

    I am currently porting a Qt application from 4.8.4 to 5.1.
    In some files I got the error message:

    missing binary operator before token "("

    in the line where the macro QT_DEPRECATED_SINCE is called.

    For example the error appears in qnamspace.h, qchar.h, qstring.h, qmetatype.h, qobject.h, qvariant.h.

    Any Ideas about this problem?

    Michael



  • You should replace by: "QVariant::value()":http://qt-project.org/doc/qt-5.0/qtcore/qvariant.html#value



  • I don't know what you mean. There is no QVariant within the Error.
    For example it appears in qnamespace.h in line 1443 with the following lines:

    #if QT_DEPRECATED_SINCE(5, 0)
    typedef WindowFlags WFlags;
    #endif

    and in qchar.h in line 360 and 367 with the following code:

    #if QT_DEPRECATED_SINCE(5, 0)
    QT_DEPRECATED inline char toAscii() const { return toLatin1(); }
    #endif

    and

    #if QT_DEPRECATED_SINCE(5, 0)
    QT_DEPRECATED static inline QChar fromAscii(char c)
    { return fromLatin1( c ); }
    #endif

    The complete error message for qnamespace.h is the following:

    In file included from ........\qt5\qtbase\include/QtCore/qnamespace.h:1:0,
    from ........\qt5\qtbase\include/QtCore/../../src/corelib/kernel/qobjectdefs.h:45,
    from ........\qt5\qtbase\include/QtCore/qobjectdefs.h:1,
    from ........\qt5\qtbase\include\QtCore/../../src/corelib/kernel/qobject.h:48,
    from ........\qt5\qtbase\include\QtCore/qobject.h:1,
    from ........\qt5\qtbase\include\QtCore/QObject:1,
    from ....\UTA-FHE2629-1100\LimitsSPS/..\ea_setup\digitalea.h:4,
    from ....\UTA-FHE2629-1100\LimitsSPS/..\ea_setup\ea_info.h:5,
    from ....\UTA-FHE2629-1100\LimitsSPS/limits.h:5,
    from c:\mingw64\bin../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/include/stdlib.h:10,
    from c:\mingw64\bin../lib/gcc/x86_64-w64-mingw32/4.7.1/include/c++/cstdlib:66,
    from c:\mingw64\bin../lib/gcc/x86_64-w64-mingw32/4.7.1/include/c++/bits/stl_algo.h:61,
    from c:\mingw64\bin../lib/gcc/x86_64-w64-mingw32/4.7.1/include/c++/algorithm:63,
    from ........\qt5\qtbase\include/QtCore/../../src/corelib/global/qglobal.h:80,
    from ........\qt5\qtbase\include/QtCore/qglobal.h:1,
    from ........\qt5\qtbase\include/QtCore/../../src/corelib/io/qiodevice.h:45,
    from ........\qt5\qtbase\include/QtCore/qiodevice.h:1,
    from ........\qt5\qtbase\include/QtCore/../../src/corelib/io/qtextstream.h:45,
    from ........\qt5\qtbase\include/QtCore/qtextstream.h:1,
    from ........\qt5\qtbase\include/QtCore/QTextStream:1,
    from ....\UTA-FHE2629-1100\LimitsSPS\limitinfo.h:4,
    from ....\UTA-FHE2629-1100\LimitsSPS\limitinfo.cpp:1:
    ........\qt5\qtbase\include/QtCore/../../src/corelib/global/qnamespace.h:1443:24: error: missing binary operator before token "("

    so it starts with an include of the QTextStream.h



  • I found it by myself.
    I had a header file with the name limits.h.
    The stdlib.h uses also a header file with the name limits.h. The compiler was then including the wrong limits.h from my project.

    I renamed my file to limitsval.h and then it compiles correctly.



  • good :D


Log in to reply
 

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