8

I created a project in CppCheck named CppCheck_MainRls.cppcheck that includes several directories, i can run the project from the gui and it's working. my project is huge so i only need a few directories to pass through CppCheck and export the result into xml file (later to be read by jenkins)

The current command line is:

"C:\Program Files (x86)\Cppcheck\CppCheck.exe" --enable=all  --xml-version=2 "C:\Program Files (x86)\Jenkins\jobs\MainRls\workspace\Labs\VC++\AllShared" 2> cppcheck_result.xml

which is working great for the "AllShared" directory, how can i change it to read my project file?

Mike Tishler
  • 183
  • 10

2 Answers2

5

I am a cppcheck developer. Currently, you can't use a gui project file directly in the shell client. However it is a good idea to allow it.

Daniel Marjamäki
  • 2,907
  • 15
  • 16
  • 1
    Thank you, can you give any workaround how to check several directories from command line and export into one xml (to be read by jenkins) ? – Mike Tishler Jan 09 '14 at 09:38
  • I spent about an hour trying to get this to work (cppcheck v1.86), because surely it would, only to find this response on SO. Very disappointing and annoying. – ahogen Jan 08 '19 at 18:25
  • Since time has changed, and thankfully you implemented this feature as described in [the answer given by Mike B.](https://stackoverflow.com/a/61367105/2932052): I'm using version 2.9, so it should work, but it didn't. I tried `cppcheck --help` and also read [the docs mentioned there](https://cppcheck.sourceforge.io/manual.pdf). Is this feature maybe broken temporarily? Thanks in advance for taking a look! – Wolf Sep 13 '22 at 14:25
  • It should work. Would it be possible to discuss your problems in cppcheck forum? https://sourceforge.net/p/cppcheck/discussion/ ? – Daniel Marjamäki Sep 16 '22 at 18:13
4

As of April 2020 (cppcheck v1.90), this is supported per the cppcheck manual (PDF) section 3.1:

3.1 Cppcheck GUI project

You can import and use Cppcheck GUI project files in the command line tool:

cppcheck --project=foobar.cppcheck

Community
  • 1
  • 1
Mike B.
  • 81
  • 1
  • 6
  • In version 2.9, this is not working as described by the documentation. I'm getting *cppcheck: error: could not find or open any of the paths given.*, while it runs fine in the Cppcheck GUI application. Do you have any ideas what to try next? – Wolf Sep 13 '22 at 14:18