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 hereHow can I fix this? As it looks signals and slots don't work since I have this warning. Thank you for your help.
-
Hi
That sounds almost impossible :)Can you check if a normal default gui project still works?
-
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 hereHow can I fix this? As it looks signals and slots don't work since I have this warning. Thank you for your help.
What's the compiler version and OS you're working with?
-
Hi
That sounds almost impossible :)Can you check if a normal default gui project still works?
-
@kshegunov
I'm running Qt 5.8 on Windows 10 with MinGW32bit. -
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? -
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?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.
-
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.
@gabor53
Hi
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 -
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. -
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.@Chris-Kawa This helped me get rid of the warning. Thank you very much.
-
The workaround from @Chris-Kawa is not working for me properly.
First in Qt Creator 10.0.0 the path is Edit->Preferences->C++->Clangd->Build-system warnings.
Second it suppresses all diagnostics from the build system, that's why it's not showing the warning anymore.The only workaround that I've found is to disable "-Wsuggest-override" completely from the clangd checks by editing .clangd file in the project root directory and adding there
CompileFlags: Remove: [-Wsuggest-override]
-
The workaround from @Chris-Kawa is not working for me properly.
First in Qt Creator 10.0.0 the path is Edit->Preferences->C++->Clangd->Build-system warnings.
Second it suppresses all diagnostics from the build system, that's why it's not showing the warning anymore.The only workaround that I've found is to disable "-Wsuggest-override" completely from the clangd checks by editing .clangd file in the project root directory and adding there
CompileFlags: Remove: [-Wsuggest-override]
@nslw said:
The workaround from @Chris-Kawa is not working for me properly.
It's been 6 years. Things change ;)
In year 2023 go to Edit->Preferences->C++->Clangd->Build-system and make a copy of the "Build-system warnings" configuration. In its properties add
-Wno-inconsistent-missing-override
. This will disable this particular waning from clangd, but it will also come from the build system, so you have to disable it there too. How you do it will depend on your compiler and build tool. For example if you use qmake and gcc you can addQMAKE_CXXFLAGS += -Wno-inconsistent-missing-override
in the .pro file. -
@nslw said:
The workaround from @Chris-Kawa is not working for me properly.
It's been 6 years. Things change ;)
In year 2023 go to Edit->Preferences->C++->Clangd->Build-system and make a copy of the "Build-system warnings" configuration. In its properties add
-Wno-inconsistent-missing-override
. This will disable this particular waning from clangd, but it will also come from the build system, so you have to disable it there too. How you do it will depend on your compiler and build tool. For example if you use qmake and gcc you can addQMAKE_CXXFLAGS += -Wno-inconsistent-missing-override
in the .pro file.@Chris-Kawa said in All .h files have a warning for Q_OBJECT:
@nslw said:
The workaround from @Chris-Kawa is not working for me properly.
It's been 6 years. Things change ;)
This hasn't changed though ;) Your workaround still doesn't work for me, because the warning comes from
-Wsuggest-override
and not from-Winconsistent-missing-override
. Adding-Wno-inconsistent-missing-override
, as you suggest, doesn't help at all and just cripples clangd more, as it stops reporting inconsistent missing overrides.I use CMake, and add
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override")
but I have to disable it in clangd, as I described earlier. This fixes it for me in QtCreator. I get no warnings from
-Wsuggest-override
(bad), but I still get non-purposedly-hidden/overriden warnings from-Winconsistent-missing-override
(good). -
@Chris-Kawa said in All .h files have a warning for Q_OBJECT:
@nslw said:
The workaround from @Chris-Kawa is not working for me properly.
It's been 6 years. Things change ;)
This hasn't changed though ;) Your workaround still doesn't work for me, because the warning comes from
-Wsuggest-override
and not from-Winconsistent-missing-override
. Adding-Wno-inconsistent-missing-override
, as you suggest, doesn't help at all and just cripples clangd more, as it stops reporting inconsistent missing overrides.I use CMake, and add
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override")
but I have to disable it in clangd, as I described earlier. This fixes it for me in QtCreator. I get no warnings from
-Wsuggest-override
(bad), but I still get non-purposedly-hidden/overriden warnings from-Winconsistent-missing-override
(good).@nslw Then replace
-Wno-inconsistent-missing-override
with-Wno-suggest-override
in the settings I mentioned.