cppcheck can't find include files
34,200
Solution 1
cppcheck is really bad at finding standard include headers, on Mac and Linux. Fortunately, you can suppress this check, and only scan your custom header files:
cppcheck --enable=all --suppress=missingIncludeSystem .
Solution 2
It isn’t recommended to provide the paths to the standard C/C++ headers - Cppcheck has internal knowledge about ANSI C/C++ and it isn’t recommended that this known functionality is redefined. But feel free to try it.
-I [dir]
Give include path. Give several -I parameters to give several paths. First given path is checked first. If paths are relative to source files, this is not needed.
Related videos on Youtube
Comments
-
pic11 almost 2 years
cppcheck can't find even standard headers such as iostream. Any ideas?
I am using Ubuntu 11.04 and cppcheck from the repository.
-
eugene_che almost 13 yearsCheck if they are installed...
-
Admin almost 13 years@tyz: I think the idea is that cppcheck knows about ANSI/C++ w/o any headers. So I think it won't even understand gcc specific system headers etc..
-
-
Drew Noakes over 10 yearsThe
-I
option can makecppcheck
run very slowly if you bring in a lot of headers. -
Andy Krouwel almost 9 yearsAnd don't get it mixed up with the '-i' (ignore) option.
-
helmesjo almost 7 yearsThis supress-flag gives me the following error:
Unmatched suppression: missingIncludeSystem
... Or does this simply mean that the check didn't suppress any arror? Can I suppress the non-suppressed suppress-error then? O:) -
tjysdsg about 5 yearsI think this is a better answer, at least for me, my headers are not in to project root directory. So if suppressing the warning no headers will be checked.
-
Eric Backus almost 4 yearsYes, you can suppress the 'unmatched suppression' error, with --suppress=unmatchedSuppression. :)