Code::Blocks Forums

User forums => Help => Topic started by: Krice on June 19, 2025, 12:44:10 pm

Title: Cppcheck settings?
Post by: Krice on June 19, 2025, 12:44:10 pm
When I run cppcheck (on latest Code::Blocks) it's reporting warnings about invalid C code (using classes...) but at the same time it's also reporting all typical C++ warnings. The class warning tells to "Use --std, -x or --language to enforce C++." How do you add those flags for cppcheck? It's kind of annoying to get those extra warnings for each class. Also, is there a way to read .xml output in human readable format?
Title: Re: Cppcheck settings?
Post by: Miguel Gimenez on June 19, 2025, 06:19:36 pm
I used it with C::B and did not need command line switches; it will default to the last version of C or C++.

Anyway, cppcheck usage is OT here; you can ask in their forum (https://sourceforge.net/p/cppcheck/discussion/general/).

EDIT:

Quote
is there a way to read .xml output in human readable format?

Are you using the GUI?
Title: Re: Cppcheck settings?
Post by: blauzahn on June 19, 2025, 08:19:35 pm
You can add these flags in settings|environment|CppCheck/Vera++|CppCheck arguments. So, if you have a c++ project e.g.:
Code
--verbose --enable=all --xml --language=c++ --std=c++20

If you do not need cross-translation checks, then the option -j 8 can use multiple cores to speed things up significantly.

The messages should show up readable in the CppCheck/Vera++ messages log panel.

Title: Re: Cppcheck settings?
Post by: Krice on June 20, 2025, 12:07:51 pm
You can add these flags in settings|environment|CppCheck/Vera++|CppCheck arguments.

Right, the settings were there.. I tried to find it from Editor settings. Thanks, now it works.