Remote-SSH でリモートのLinux開発機のgccを使うときは、次のように設定ファイルを書く
{ "configurations": [ { "name": "Linux", "compilerPath": "/usr/bin/gcc", "cStandard": "gnu99" }, { "name": "Linux クロス", "compilerPath": "/usr/bin/arm-linux-gnueabihf-gcc", "cStandard": "gnu99" } ], "version": 4 }
今どの設定を使っているかは設定は右下に表示されてて、そこから選択もできる
各変数はだいたいこんな感じ
| configuration | 設定の配列 |
|---|---|
| name | 設定の名前。Unkoでもなんでもいいけど必須 |
| compilerPath | コンパイラのパス。 書かなければ gcc になるけど、一応書いとく |
| includePath | インクルードパス。 書かないときは vscode-server がgccから勝手に取得する |
| defines | ソースコードには書いてない定数 (makeで -D で渡してる定数とか)はここに書く。渡してなければ書かない |
| intelliSenseMode | インテリセンスのモード選択。 書かなくても gcc って書いてあるからわかる |
| cStandard | Cのバージョン。 書かないとvscode-serverがgccのバージョンを見て適当に決める。 書かなくてもよいが、gnu11でないと使えない定数とかあるし、ちゃんと書く |
| cppStandard | C++のバージョン |
| version | 4固定。必須 |
しっかり目に書くとこんな感じ
{ "configurations": [ { "name": "Linux", "compilerPath": "/usr/bin/gcc", "includePath": [ "/usr/include", "/usr/include/x86_64-linux-gnu" ], "defines": [ "_POSIX_C_SOURCE=200809L", "_GNU_SOURCE" ], "intelliSenseMode": "linux-gcc-x64", "cStandard": "gnu11", "cppStandard": "gnu++17" } ], "version": 4 }