Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
disabling compiler warnings in Creator editor?
Is there a way to disable (selectively or otherwise) the compiler warnings that show up in Creator? I'm aware that I can eliminate the text of the warning by turning off line annotations, but I'm wondering whether I can eliminate them entirely.
The warning in question is about the use of old-style casting. I can eliminate this at compile time with -Wno-old-style-cast, but I don't know how to apply that to the editor.
Not in the editor (it's unrelated to it), but you can disable that in your .pro file by setting the appropriate compiler flag.
@SGaist so...no way to suppress the warning in the editor?
AFAIK, if you eliminate it at compile time, it should not appear in the list either.
Hmm...did I not properly form this line in my .pro file?
QMAKE_CXXFLAGS += "-Wno-old-style-cast"
Just to be sure You did not mean these ?
Ok it looks clangcode model but not 100% sure
Disable it and restart Creator and see.
Mrjj: that was it. Thanks very much...I'd never really had reason to look at code model options before, so I never would have found that.
@mzimmers If it is your own code you should rather fix these warnings instead of ignoring them.
As already said, better is fixing that issues - but sometimes you cannot do it for legacy projects.
Solution in that case is not to disable the Clang plugin, but to configure it:
Tools > Options > C++ > Code Model > Clang Code Model > Manage
There you can create your own config and apply either global or for a single project.
PS: The config switch you are looking for should be
Thanks, aha. In this case, the warnings come header files supplied by a third party and intended for use with C (which I don't believe has the modern casts yet, and in any event, needs to be retroactively compatible with older compilers), so fixing them is out.
Thanks for the lesson on managing the code model...another part of Creator I'd never used, so that was a good thing to get exposed to.
koahnig last edited by
You may also tune the clang code model and ignore single warnings to be displayed in the editor.
You may want to check out last of post here
Possibly you can switch off the macros before and on after the include. I would expect that the clang code model will be able to pick it up. As said by many before, it is not a good idea to ignore warnings. As a matter of fact I start to love the warnings shown directly in the code editor. Even though it is a bit confusing the first time ;)