All .h files have a warning for Q_OBJECT

  • Hi,
    All my .h files has the following warning for Q_OBJECT (which is underlined by a yellow line):

    lexical or Preprocessor Issue Wunknown-pragmas
    13:5: warning: unknown warning group '·Wsuggest-override', ignored qobjectdefs.h:205:5: note: expanded from macro 'Q..OBJECT'
    qobjectdefs.h:189:45: note: expanded from macro 'Q..OBJECT_NO_OVERRJDE_WARNI NG' qcompilerdetectoon.h:1306c49: note: expanded from macro 'QT_WARNI NG_DISABLE_GCC' qcompilerdetectoon.h:1266:49: note: expanded from macro 'QT_OO_PRAGMA'
    :14:25: note: expanded from here

    How can I fix this? As it looks signals and slots don't work since I have this warning. Thank you for your help.

  • Qt Champions 2017

    That sounds almost impossible :)

    Can you check if a normal default gui project still works?

  • Qt Champions 2017

    What's the compiler version and OS you're working with?

  • @mrjj
    I tried a few examples and I got the same warning.

  • @kshegunov
    I'm running Qt 5.8 on Windows 10 with MinGW32bit.

  • Qt Champions 2017

    ok so it sounds like your
    Qt installation was damaged somehow.

    When did it start ?
    Did you upgrade Qt version or how/when did error start to come?

  • It started when I added a few components to the installation. I guess I have to teinstall Qt.

  • @mrjj

    I reinstalled Qt 5.8 several times. The latest is from the online installer. I still have the same error message. I'm running MinGW 32 bit. I tried several examples from Qt, but I keep getting the same error message. Any idea what is going on? Thank you.

  • Qt Champions 2017

    Is Qt5.8 mingw the only Qt you have installed ?
    There is no other Qt or compiler installed ?

    I have never seen this error nor does google so I am bit lost on what it can be.
    Only clue is ClangCodeModel.
    Check is DISABLED at
    Help > About Plugins > C++ > ClangCodeModel

  • Moderators

    It's a bug: QTCREATORBUG-17518.
    You don't need to disable clang model. To workaround go to Tools->Options->C++->Code Model, press Copy to create a custom config, add -Wno-unknown-pragmas to the config text, apply and restart QtCreator. The warning should go away.

  • I had to disable the ClangCodeModel to get rid of the warning. No other methods worked. Thank you for your help.

  • @Chris-Kawa This helped me get rid of the warning. Thank you very much.

Log in to reply

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