Linux command
cppclean 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Find problems
cppclean [path/to/source]
Check specific files
cppclean [file1.cpp] [file2.cpp]
Include additional header search paths
cppclean --include-path [/path/to/includes] [source/]
Run with verbose output
cppclean --verbose [path/to/source]
Suppress output messages
cppclean --quiet [path/to/source]
说明
cppclean finds problems in C++ source that slow development in large code bases, including various forms of unused code. It detects unnecessary #include directives in header files, unused forward declarations, functions declared but not defined, and classes with virtual methods but no virtual destructor. The tool identifies which headers can be safely removed, reducing compilation dependencies and speeding up incremental builds. It also detects inconsistent casing in #include paths (e.g., `foo.h` vs `Foo.h`) and global/static data that may cause problems with threads.
参数
- --include-path _path_
- Additional include search path (like gcc -I). Can be specified multiple times. Not recursive.
- --verbose
- Enable verbose output for debugging.
- --quiet
- Suppress output messages.
FAQ
What is the cppclean command used for?
cppclean finds problems in C++ source that slow development in large code bases, including various forms of unused code. It detects unnecessary #include directives in header files, unused forward declarations, functions declared but not defined, and classes with virtual methods but no virtual destructor. The tool identifies which headers can be safely removed, reducing compilation dependencies and speeding up incremental builds. It also detects inconsistent casing in #include paths (e.g., `foo.h` vs `Foo.h`) and global/static data that may cause problems with threads.
How do I run a basic cppclean example?
Run `cppclean [path/to/source]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --include-path _path_ do in cppclean?
Additional include search path (like gcc -I). Can be specified multiple times. Not recursive.