Cppcheck: how to skip a directory of third party header files?

Another possibility would be to use suppressions via a file (see manual chapter 7 “Listing suppressions in a file”) or via commandline.

Your suppressions.txt could be

*:/path/to/your/thirdpartylibs/*

Which would exclude all errors from that path. The syntax is

[error id]:[filename]:[line]

with wildcard support for * (multiple characters) and ? (single character).

The call to cppcheck would then be

cppcheck --suppressions-list=suppressions.txt .

Leave a Comment