Include What You Use is a source analysis tool for C and C++ projects built on Clang.
It checks whether each translation unit directly includes the headers needed for the symbols it uses, helping developers identify unnecessary includes, tighten dependencies, and keep source files more self-contained. The project is intended for integration into existing build workflows and also ships helper scripts for project-wide analysis and automated include cleanup.
This is free and open source software.
Key Features
- Analyzes C and C++ source files to determine which headers should be included for the symbols in use.
- Helps detect superfluous includes so projects can reduce unnecessary header dependencies.
- Can be run on individual source files with normal compiler flags.
- Supports integration with existing build systems by replacing the compiler invocation in batch runs.
- Works with CMake through the CMAKE_CXX_INCLUDE_WHAT_YOU_USE and CMAKE_C_INCLUDE_WHAT_YOU_USE options.
- Includes the iwyu_tool.py helper for running analysis across projects that provide compile commands.
- Ships fix_includes.py to apply recommended include changes automatically.
- Provides Clang version specific branches and release mappings to match the tool with compatible Clang versions.
Website: github.com/include-what-you-use/include-what-you-use
Support:
Developer: include-what-you-use contributors
License: University of Illinois/NCSA Open Source License
Include What You Use is written in C++. Learn C++ with our recommended free books and free tutorials.
Related Software
| C and C++ Linters | |
|---|---|
| OCLint | Static code analysis tool for improving quality and reducing defects |
| cpplint | Static code checker for C++ |
| Uncrustify | Source code beautifer |
| Include What You Use | Source analysis tool for C and C++ projects built on Clang |
| Cppcheck | Static analysis tool for C/C++ code |
| ClangFormat | Code formatting tool |
| Clang-Tidy | Clang-based C++ “linter” tool |
Read our verdict in the software roundup.
Explore our carefully curated directory of recommended free and open source software, covering every major software category.The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more. Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form. |


Please read our Comment Policy before commenting.