Inspectopedia 2025.2 Help

Unused Include Directive

Reports the include directives that are not used or not required and can be removed safely.

Detect completely unused

An include directive is considered unused if declarations from it are never used within the translation unit.

Detect not directly used

An include directive is considered unused if declarations from it are not used in the file directly. This works best with the "Include What You Use" policy.

Detect not required

Detects the minimal set of include directives for the file to be compilable. All other #include directives are considered unused.

Use the checkbox below to run inspection in header files.

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

OCUnusedIncludeDirective
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | C/C++ | Unused code

Inspection options

Here you can find the description of settings available for the Unused Include Directive inspection, and the reference of their default values.

Run inspection in header files

Option ID:

showInHeaders

Default value:

Not selected

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection OCUnusedIncludeDirective

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

CLion 2025.2,

Can be installed with plugin:

CLion, 2025.2

Last modified: 18 September 2025