Cpplint is an open source tool used to check source code against the Google C++ Style Guide. The code is run from the command line as shown below, and results in output similar to that shown
$ cpplint file1.cpp file.cpp:1: Include the directory when naming .h files [build/include_subdir] [4] file.cpp:2: Include the directory when naming .h files [build/include_subdir] [4] file.cpp:88: Use int16/int64/etc, rather than the C type long [runtime/int] [4] file.cpp:89: Use int16/int64/etc, rather than the C type long [runtime/int] [4]
The style guide suggests that all header files should be listed relative to the projects source directory without use of unix aliases such as .
(current directory) or ..
(parent directory). As such, the format for an include of a file located at project/src/base/file.h
would look like
#include "base/file.h"
Where integer types are concerned the guide suggests that the only built-in integer type that should be used is int
, and that all other required types should be taken from <stdint.h>
implying that short should be replaced with int16_t
and long long
with int64_t
. The standard also suggests that the use of unsigned types should be avoided unless they are specifically required.
Supposing that you don’t want to modify your code to remove these warning messages. One solution is to call cpplint using filters as shown below:
$ cpplint --filter=-build/include_subdir --filter=-runtime/int file1.cpp