概要
- 準備
- 手順
- compile_commands.json を用意する
make allyesconfig && make -j $(nproc) && make compile_commands.json- Clion を一度開いて、以下の設定を入れておく
Help > Change Memory Settingsで適当にHeapのサイズを上げるHelp > Edit Custom Propertiesで以下の2つの値を大きくする- idea.max.intellisense.filesize
- idea.max.content.load.filesize
- Clionで compile_commands.json を開いて、linuxディレクトリをCompilation database projectとして認識させる
Buildタブでlinux: finixshed,Compilation database project successfully importedというメッセージが出ることを確認する- (多分) しばらくすると、Clionがコードをキャッシュし始めて、定義ジャンプできるようになる
- コードのキャッシュが始まらないと、定義ジャンプできるようにはならない
- 最初は定義ジャンプ出来なかったが、いくつかのコードで定義ジャンプを試していたらコードのキャッシュが始まって、完了したら定義ジャンプできるようになった
メモ
- Clionがリモート接続になると,
Unable to open the remote file Compiler Info Errors: the file is too largeのエラーを設定で解消できない- devcontainerなどでツールを用意しても、このエラーが問題になる
- https://youtrack.jetbrains.com/projects/CPP/issues/CPP-42296/Unable-to-open-the-remote-file-compilecommands.json-the-file-is-too-large
- 自分はnix shellで開発環境を作り、
.envrcにuse flakeを定義して、Clionからdirenv pluginを使うようにした