CLion 2023.2 ヘルプ

プロジェクトフォーマット

CLion には一連のスマート機能が組み込まれており、その多くはプロジェクトレベルの情報(インクルードファイル、コンパイラーフラグ、リンカーオプション)に依存しています。この情報により、CLion はコードを正しく解析 / 解決できるため、エラーのない便利な方法でコードをハイライト、自動補完、インスペクション、移動できます。

CLion は独自のプロジェクトモデルをコードに提供するのではなく、次の形式をサポートしています。

さらに、外部ツールを呼び出してビルドとクリーンアップを実行するカスタムビルドターゲットを設定し、そのようなターゲット用のカスタム実行 / デバッグ構成を作成できます。カスタムターゲットは特定のビルドシステムから独立しているため、たとえば、compilation database プロジェクトのビルドと実行の機能を提供できます。

以下の表は、さまざまなプロジェクトレベル、リモート、および動的解析機能が各プロジェクトフォーマットでどのようにサポートされているかを示しています (簡潔にするために compilation databaseCompDB と呼ばれます)。この表にはリモート GDB/gdbserver は含まれていません。これは、CLion での実装がどのプロジェクトモデルからも完全に独立して機能するためです。

Google Sanitizers およびコードカバレッジの場合、一部のプロジェクトフォーマットには黄色のチェック visualized output unavailable が付いています。つまり、これらの機能を構成して CLion で結果を取得できても、出力はプレーンテキストでコンソールに記録されます。サニタイザーとコードカバレッジ出力の視覚化は、CMake プロジェクトでのみ使用できます。

また、サポートされている feature is supported としてマークされている機能の一部は、そのままでは機能しない場合があり、使用を開始する前に追加の構成手順を実行する必要があることに注意してください。

CMake

CompDB

CompDB と

カスタムターゲット

および構成

Gradle

Makefile

開く

プロジェクト

feature is supported
feature is supported
feature is supported
feature is supported
feature is supported

新規プロジェクト

ウィザード

feature is supported
feature is not supported
feature is not supported
feature is not supported
feature is not supported

ビルド

feature is supported
feature is not supported
feature is supported
feature is supported
feature is supported

実行 / デバッグ

feature is supported
feature is not supported
feature is supported
feature is supported
feature is supported

Valgrind Memcheck

feature is supported
feature is not supported
feature is supported
feature is supported
feature is supported

プロファイラー

feature is supported
feature is not supported
feature is supported
feature is supported
feature is supported

Sanitizers

feature is supported
feature is not supported

visualized output unavailable

feature is not supported

visualized output unavailable

コードカバレッジ

feature is supported
feature is not supported
feature is not supported
feature is not supported
feature is not supported

Gateway を使用したリモート

feature is supported
feature is supported
feature is supported
feature is not supported
feature is supported

ローカルソースを使用したリモート

feature is supported
feature is not supported
feature is not supported
feature is not supported
feature is supported

WSL

feature is supported
feature is supported
feature is supported
feature is not supported
feature is supported

Docker

feature is supported
feature is not supported
feature is not supported
feature is not supported
feature is supported

関連ページ:

クイック CMake チュートリアル

このチュートリアルでは、CLion で単純な CMake プロジェクトを作成および開発するプロセスを説明します。段階的に、ビルドシステムとしての CMake の基本と、CMake 固有の IDE 設定とアクションを学習します。1. シンプルな CMake プロジェクト:CMake は、CMakeLists と呼ばれるスクリプトを使用して、特定の環境用のビルドファイル (Unix マシンのメイクファイルなど) を生成するメタビルドシステムです。CLion で新しい CMake プロジェクトを作成すると、...

Gradle

Gradle は、C/C++ ライブラリとアプリケーションをビルドするためのプラグインを提供するビルド自動化システムです。CLion では、cpp-application および cpp-library プラグインに基づく Gradle プロジェクトを操作できます(C/C++ Gradle プラグインの詳細については、このブログ投稿: 新しい C++ プラグインの紹介を参照してください)。CLion での完全に機能する Gradle サポートは開発中です。フィードバックを共有し、このチケットの更新をフォロ...

Compilation database

CMake、Gradle、Makefile に基づいていないプロジェクトで作業している場合でも、CLion が提供する高度な IDE 機能を利用できます。1 つの方法は、非 CMake プロジェクトをインポートし、CLion にそれを単純な CMake 構造に変換させることです。別のオプションは、compilation database をロードしてプロジェクトを開くことです。compilation database を使用すると、CLion はプロジェクトファイルを検出し、インクルードパスやコンパ...

Makefile プロジェクト

CLion での Makefile プロジェクトの完全なサポートは、まだ進行中の作業です。CPP-494 にリンクされたチケットを使用して、フィードバックを残し、希望する機能に投票してください。Makefile プロジェクトを開くメインメニューからを選択します。CLion に、最上位の Makefile が含まれているフォルダーまたはそのファイルを直接ポイントします。開いたダイアログで、プロジェクトとして開くをクリックします。プロジェクトをクリーンアップするように求められます。Make ビルドはインク...

カスタムビルドのターゲットとアプリケーション

カスタムビルドターゲットは、特定のビルドシステムやプロジェクトモデルに依存しません。CLion は、ソースのビルドとビルドアーティファクトのクリーニングに選択した外部ツールを使用します。カスタムターゲットは、compilation database プロジェクトで特に役立ちます。compile_commands.json 自体にはアプリケーションの構築と実行に必要な情報が不足していますが、カスタムターゲットとカスタム実行 / デバッグ構成はこの制限を回避できます。次の例では、compilation...

動的コード分析

動的コード分析は、実行中にアプリケーションを分析する方法です。このアプローチは、メモリリーク、初期化されていないアクセス、同時実行性の問題、未定義の動作状況など、実行時にしか明らかにならない脆弱性やバグを明らかにしやすくします。動的解析を使用する場合は、次の点に注意してください。動的分析ツールはアプリケーションのパフォーマンスを低下させる可能性があります。動的テストでは、実際に実行されたコードに欠陥が見つかるだけなので、フルカバレッジ問題は個別に対処する必要があります。CLion はいくつかの動...