How do i run a saved project from command line in CppCheck
Asked Answered
O

2

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?

Orthodontia answered 8/1, 2014 at 7:8 Comment(0)
B
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.

Bozeman answered 9/1, 2014 at 7:28 Comment(4)
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) ?Orthodontia
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.Grekin
Since time has changed, and thankfully you implemented this feature as described in the answer given by Mike B.: 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. Is this feature maybe broken temporarily? Thanks in advance for taking a look!Geoponic
It should work. Would it be possible to discuss your problems in cppcheck forum? sourceforge.net/p/cppcheck/discussion ?Quinta
J
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

Jessy answered 22/4, 2020 at 14:5 Comment(2)
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?Geoponic
Then it is a bug please report it in Cppcheck discussion forum or issue trackerQuinta

© 2022 - 2024 — McMap. All rights reserved.