# Auto-import

When you reference a symbol that has not yet been imported, CLion helps you locate the file – which is typically a header that contains the declaration or definition of that symbol – and adds it to the list of includes.

Procedure: Import a missing header file

1. Type a reference to a non-imported class or function.

![Auto-import suggestion](https://resources.jetbrains.com/help/img/idea/2026.2/cl_auto_import.png)

2. Press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `⌥ ⏎` (Xcode), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Alt+Enter` (ReSharper), `⌥ ⏎` (ReSharper (macOS)), `Alt+Enter` (QtCreator), `⌥ ⏎` (QtCreator (macOS)), `Alt+Enter` (NetBeans), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)). The import symbol will be added to the imports section:

![Auto-import added](https://resources.jetbrains.com/help/img/idea/2026.2/cl_auto_import_added.png)

3. If there are multiple choices for auto import, you will see the corresponding popup:

![Auto-import multiple choices](https://resources.jetbrains.com/help/img/idea/2026.2/cl_auto_import_multiple.png)

Press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `⌥ ⏎` (Xcode), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Alt+Enter` (ReSharper), `⌥ ⏎` (ReSharper (macOS)), `Alt+Enter` (QtCreator), `⌥ ⏎` (QtCreator (macOS)), `Alt+Enter` (NetBeans), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)) and select the preferred option from the list:

![Auto-import multiple choices popup](https://resources.jetbrains.com/help/img/idea/2026.2/cl_auto_import_multiple_popup.png)

4. If the auto-import popup is disabled in `Settings | Languages & Frameworks | C/C++ | General`, you will see a quick-fix when hovering over a non-imported symbol:

![Auto-import quick-fix](https://resources.jetbrains.com/help/img/idea/2026.2/cl_auto_import_quickfix.png)

If there are multiple choices for auto import, click `More actions...` and select the preferred option from the list:

![Auto-import options](https://resources.jetbrains.com/help/img/idea/2026.2/cl_auto_import_options.png)

Procedure: Configure auto-import

There are several settings that control the behavior of the auto-import feature.

* Enable or disable popups for import actions in `Settings | Languages & Frameworks | C/C++ | General`: ![Auto-import popup settings](https://resources.jetbrains.com/help/img/idea/2026.2/cl_auto_import_popup.png)

* You can use auto-importing during code completion, which automatically adds include directives after completing a symbol. Configure this option in `Settings | Editor | General | Code Completion`: ![Auto-import completion settings](https://resources.jetbrains.com/help/img/idea/2026.2/cl_auto_import_completion.png) Select the preferred behavior for importing items from the drop-down list: ![Auto-import completion behavior](https://resources.jetbrains.com/help/img/idea/2026.2/cl_auto_import_completion_behavior.png) Below, you can also enable or disable the option `Add #include after completion of member of incomplete class`.

* There are also two syntax-related options in `Settings | Editor | Code Style | C++ | Syntax Style`: ![Auto-import syntax style options](https://resources.jetbrains.com/help/img/idea/2026.2/cl_auto_import_syntax.png) | Option | Functionality | | --- | --- | | `Sort include directives` | Highlights `#include` directives that violate the sorting order. | | `Use angle brackets instead of quotes` | Allows you to specify cases where generated include directives are added in angle brackets. |

## See also

### Code Editing

[Code style settings for C and C++](settings-code-style-c-cpp.html)

### Reference

[Code Style](settings-code-style.html)

