LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

cppclean

C++ unused code and header finder

TLDR

Find problems in a directory
$ cppclean [path/to/source]
copy
Check specific files
$ cppclean [file1.cpp] [file2.cpp]
copy
Include additional header search paths
$ cppclean --include-path [/path/to/includes] [source/]
copy
Run with verbose output
$ cppclean --verbose [path/to/source]
copy
Suppress output messages
$ cppclean --quiet [path/to/source]
copy

SYNOPSIS

cppclean [options] paths...

DESCRIPTION

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.

PARAMETERS

--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.

INSTALL

nix profile install nixpkgs#cppclean
copy

CAVEATS

May report false positives for conditionally compiled code (e.g., `#ifdef` blocks). Results should be verified before removing includes. Detection of unnecessary includes in source files (not headers) is limited.

SEE ALSO

clang-tidy(1), cppcheck(1), cpplint(1), gcc(1), cmake(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid