# ビルドなしでファイルをコンパイルする

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/ja-jp/help/clion/llms.txt).

> **TL;DR**
> `ビルド | 再コンパイル`

開発プロセスをスピードアップするために、プロジェクト全体をビルドせずに 1 つのファイルをコンパイルしたい場合があります。 この目的のために、CLion は   再コンパイル   アクションを提供します。

再コンパイル   は、個々のソースファイルとヘッダーファイル、およびプロジェクトツリーで選択されたファイルのグループで利用できます。 ヘッダーの場合、CLion は [resolve コンテキスト](switching-resolve-context.html)を使用して、指定されたヘッダーを含むソースファイルの 1 つをコンパイルします。   再コンパイル   は、ディレクトリおよび非 C/C++ ファイルに対して無効になっていることに注意してください。

> **Tip:**
> 再コンパイル   は、 [CMake](quick-cmake-tutorial.html)、 [Makefile](makefiles-support.html)、 [中間子](meson.html)、 [compilation database](compilation-database.html) プロジェクトに使用できます。

Procedure: 再コンパイルを呼び出す

次のオプションの使用:

* 現在開いているファイルについては、メインメニューから  `ビルド | 再コンパイル`  を選択するか、 `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)) を押します。

![メインメニューから再コンパイルする](https://resources.jetbrains.com/help/img/idea/2026.3/cl_recompile_mainmenu.png)

* プロジェクトツリー内のファイルの場合、コンテキストメニューから   再コンパイル   を選択します (または同じ `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)) ショートカットを使用します)。

![右クリックメニューから再コンパイルする](https://resources.jetbrains.com/help/img/idea/2026.3/cl_recompile_rightclick.png)

複数のファイルの場合は、プロジェクトツリーでファイルを選択し、コンテキストメニュー `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)) から   選択したファイルを再コンパイルする   オプションを使用します。

![プロジェクトツリー内のいくつかのファイルを再コンパイルする](https://resources.jetbrains.com/help/img/idea/2026.3/cl_recompile_selection.png)

> **Note:**
> 複数のファイルに使用すると、最初のコンパイルが失敗すると再コンパイルが停止します。

## コンパイルの詳細

Makefile / コンパイルデータベース:

Makefile または compilation database プロジェクトから呼び出されると、   再コンパイル   は、プロジェクト分析中に見つかったコンパイルコマンドを受け取り、それを変更して（出力をスキップし、  `--syntax-only`  フラグを追加）、それを使用して選択したファイルをコンパイルします。

既存ジェネレーターを使用する CMake:

> **Note:**
> 以下に説明する詳細は、次の場合に   デフォルトの CMake ジェネレーター   を使用している場合に適用されます。
>
> * CMake のバージョンは 3.19 以前です
>
> * または、 `設定 | 詳細設定` で CMake 3.20 以降にはレガシージェネレーターを使用する チェックボックスを設定しました

再コンパイル   を使用すると、直接コンパイラー呼び出しの代わりに CMake ターゲットが呼び出されます。 コール先は、使用可能な [実行 / デバッグ構成](run-debug-configuration.html)のリストに基づいて選択されます。

1.  コンパイルするファイルが現在選択されている構成に属している場合、この構成のビルドターゲットが使用されます。

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

3.  前のステップが失敗した場合、CLion はエラーを報告します。

## 結果を調べる

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

![再コンパイルが成功しました](https://resources.jetbrains.com/help/img/idea/2026.3/cl_recompile_success.png)

コンパイルが失敗すると、通知ポップアップメッセージが表示されます。

![再コンパイルに失敗しました](https://resources.jetbrains.com/help/img/idea/2026.3/cl_recompile_fail.png)

## See also

### ハウツー

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

