# Compile files without build

> **TL;DR**
> `Build | Recompile`

To speed up the development process, you may sometimes prefer to compile one file without building the whole project. For this purpose, CLion provides the Recompile action.

Recompile is available for individual source and header files, and also for groups of files selected in the project tree. For headers,  CLion uses [resolve context](switching-resolve-context.html) to compile one of the source files that include the specified header). Note that Recompile is disabled for directories and non-C/C++ files.

> **Tip:**
> You can use Recompile for [CMake](quick-cmake-tutorial.html), [Makefile](makefiles-support.html), [Meson](meson.html), and [compilation database](compilation-database.html) projects.

Procedure: Call Recompile

Use of the following options:

* For the currently opened file, select `Build | Recompile` from the main menu or press `Ctrl+Shift+F9` (Windows), `⌘ ⇧ F9` (macOS), `⌘ ⇧ F9` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ F9` (macOS System Shortcuts), `Ctrl+Shift+F9` (XWin), `Ctrl+Shift+F9` (GNOME), `Ctrl+Shift+F9` (KDE), `Ctrl+Shift+F9` (Emacs), `Ctrl+B` (Sublime Text), `⌘ B` (Sublime Text (macOS)), `⌘ ⇧ F9` (Xcode), `Ctrl+F7` (Visual Studio), `⌘ F7` (Visual Studio (macOS)), `Ctrl+F7` (ReSharper), `⌘ F7` (ReSharper (macOS)), `Ctrl+Alt+B` (QtCreator), `⌘ ⌥ B` (QtCreator (macOS)), `F9` (NetBeans), `Ctrl+Shift+F9` (Eclipse), `⌘ ⇧ F9` (Eclipse (macOS)):

![Recompile from the main menu](https://resources.jetbrains.com.cn/help/img/idea/2026.2/cl_recompile_mainmenu.png)

* For a file in the project tree, select Recompile from the context menu (or use the same `Ctrl+Shift+F9` (Windows), `⌘ ⇧ F9` (macOS), `⌘ ⇧ F9` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ F9` (macOS System Shortcuts), `Ctrl+Shift+F9` (XWin), `Ctrl+Shift+F9` (GNOME), `Ctrl+Shift+F9` (KDE), `Ctrl+Shift+F9` (Emacs), `Ctrl+B` (Sublime Text), `⌘ B` (Sublime Text (macOS)), `⌘ ⇧ F9` (Xcode), `Ctrl+F7` (Visual Studio), `⌘ F7` (Visual Studio (macOS)), `Ctrl+F7` (ReSharper), `⌘ F7` (ReSharper (macOS)), `Ctrl+Alt+B` (QtCreator), `⌘ ⌥ B` (QtCreator (macOS)), `F9` (NetBeans), `Ctrl+Shift+F9` (Eclipse), `⌘ ⇧ F9` (Eclipse (macOS)) shortcut):

![Recompile from the right-click menu](https://resources.jetbrains.com.cn/help/img/idea/2026.2/cl_recompile_rightclick.png)

For several files, select them in the project tree, and use the Recompile Selected Files option from the context menu `Ctrl+Shift+F9` (Windows), `⌘ ⇧ F9` (macOS), `⌘ ⇧ F9` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ F9` (macOS System Shortcuts), `Ctrl+Shift+F9` (XWin), `Ctrl+Shift+F9` (GNOME), `Ctrl+Shift+F9` (KDE), `Ctrl+Shift+F9` (Emacs), `Ctrl+B` (Sublime Text), `⌘ B` (Sublime Text (macOS)), `⌘ ⇧ F9` (Xcode), `Ctrl+F7` (Visual Studio), `⌘ F7` (Visual Studio (macOS)), `Ctrl+F7` (ReSharper), `⌘ F7` (ReSharper (macOS)), `Ctrl+Alt+B` (QtCreator), `⌘ ⌥ B` (QtCreator (macOS)), `F9` (NetBeans), `Ctrl+Shift+F9` (Eclipse), `⌘ ⇧ F9` (Eclipse (macOS)):

![Recompile several files in the project tree](https://resources.jetbrains.com.cn/help/img/idea/2026.2/cl_recompile_selection.png)

> **Note:**
> When used for multiple files, recompilation stops upon the first compilation failure.

## Compilation details

Makefile / Compilation database:

When called from a Makefile or a compilation database project, Recompile takes the compilation command found during project analysis, modifies it (skipping the output and adding the `--syntax-only` flag), and uses it to compile the selected file.

CMake with legacy generator:

> **Note:**
> The details described below are applicable if you are using the default CMake generator in the following cases:
>
> * your CMake version is 3.19 or earlier
>
> * or you have set the Use legacy generator for CMake 3.20 and higher checkbox in `Settings | Advanced Settings`

When you use Recompile, a CMake target is called instead of a direct compiler call. The target to call is picked based on the list of the available [run/debug configurations](run-debug-configuration.html):

1. If the file to compile belongs to the currently selected configuration, then the build target from this configuration is used.

2. Otherwise, CLion attempts to find a suitable configuration, prioritizing those with the same CMake profile as the currently selected one.

3. If the previous step has failed, then CLion reports an error.

## Examining the results

Similarly to regular builds, you can examine the results of a single file compilation in the [Message Tool Window](message-tool-window.html):

![Recompilation successful](https://resources.jetbrains.com.cn/help/img/idea/2026.2/cl_recompile_success.png)

If the compilation fails, you will get a signaling popup message:

![Recompilation failed](https://resources.jetbrains.com.cn/help/img/idea/2026.2/cl_recompile_fail.png)

## See also

### How tos

[Build Actions](build-actions.html) [Run/Debug Configurations](run-debug-configuration.html)

