In my application inside Qt, when I open some CPP file, in some I see warnings like the one I describe below:
And many others that I do not need to describe.
What I really wanted was for all these errors / alerts to be displayed in the Qt Issues tab when the application compilation is performed, but this does not happen.
Why are they not presented and is there any way to present them?
I tried to use the flags below, but none had the effect I wanted:
CONFIG += warn_on
CONFIG += exceptions
QMAKE_CFLAGS_WARN_ON = -w -Wall -Wextra
QMAKE_CXXFLAGS_WARN_ON = -w -Wall -Wextra
CFLAGS += -Wall
CXXFLAGS += -Wall
QMAKE_LFLAGS += thread
QMAKE_LFLAGS += exceptions
I just found here in stackoverflow questions to suppress the warnings.
This would make it much easier to improve the quality of the software, because the software I'm working on is legacy and I have no vision of these warnings unless I open file by file.
The warnings you see inside the editor are from the Clang code model plugin of Qt Creator. You can try changing to compiling using Clang instead of GCC/MSVC and it should hopefully give you the same warnings also during compilation.
See this help page for more information on adding compilers.
Edit: You can also trigger a manual analysis, which will display the code issues in the "Issues" pane.
To do this, open up the "Analyze" menu in the menu bar, and select "Clang-Tidy and Clazy..."
In the dialog that appears, select all files that you want to analyze, and also select "Custom Settings" from the topmost drop down, followed by "Clang-only checks for almost everything [built-in]" from the second drop down.
That option is equivalent to the default option for the Clang code model plugin, and should make the analyze output show the same issues as the inline annotations.
When you are ready, simply click "Analyze" to start and then wait until it's all complete.
See this page for even more detailed information on how to run and configure static code analysis from Qt Creator.