Author Topic: Cppcheck settings?  (Read 734 times)

Offline Krice

  • Almost regular
  • **
  • Posts: 173
Cppcheck settings?
« 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?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1729
Re: Cppcheck settings?
« Reply #1 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.

EDIT:

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

Are you using the GUI?
« Last Edit: June 19, 2025, 06:57:27 pm by Miguel Gimenez »

Offline blauzahn

  • Almost regular
  • **
  • Posts: 180
Re: Cppcheck settings?
« Reply #2 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.


Offline Krice

  • Almost regular
  • **
  • Posts: 173
Re: Cppcheck settings?
« Reply #3 on: Yesterday at 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.