When running e.g.:
cppcheck --project=compile_commands.json test.cpp
And given a compile_commands.json file where some of the files do not exist, cppcheck always fails with an error of the form:
cppcheck: error: '/path/to/some/file_that_doesnt_exist.cpp' from compilation database does not exist
cppcheck: error: failed to load project 'compile_commands.json'. An error occurred.
I wonder whether there's something obvious I'm missing here, since it's very common to have generated intermediate files in a compile_commands.json that may not be built in all cases? This error seems to suggest that cppcheck doesn't work with ANY project that has generated files, or in cases where ANY file is referenced in compile_commands but doesn't exist - both exceedingly common scenarios.
This can be reproduced by adding a non-existent file to any compile_commands.json of any project and then running cppcheck with the --project command (I've tried this on several projects).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When running e.g.:
cppcheck --project=compile_commands.json test.cpp
And given a compile_commands.json file where some of the files do not exist, cppcheck always fails with an error of the form:
cppcheck: error: '/path/to/some/file_that_doesnt_exist.cpp' from compilation database does not exist
cppcheck: error: failed to load project 'compile_commands.json'. An error occurred.
I wonder whether there's something obvious I'm missing here, since it's very common to have generated intermediate files in a compile_commands.json that may not be built in all cases? This error seems to suggest that cppcheck doesn't work with ANY project that has generated files, or in cases where ANY file is referenced in compile_commands but doesn't exist - both exceedingly common scenarios.
This can be reproduced by adding a non-existent file to any compile_commands.json of any project and then running cppcheck with the --project command (I've tried this on several projects).
sorry about late reply. I have created this ticket: https://trac.cppcheck.net/ticket/13946