0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Visual Studio Code includePath の修正

Posted at

組み込み開発なんかで include の候補が沢山あって VSCode が迷う時の対策方法。

基本的には Cmd+shift+P > C/C++: Edit Configurations (JSON) または .vscode/c_cpp_properties.json を直接開いて includePath を追加編集すれば良い。ただ、候補が沢山あって欲しいバージョンを上手く探してくれない時があるので、以下のようにして推理する。

  • Cmd+shift+P > C/C++: Log Diagnostics
  • なんとなく解決のヒントがずらずら出てくる。

例えば includePath がこうなってるとする。

"includePath": [
    "${workspaceFolder}/**",
    "~/sdk/sysroots/hoge-linux-gnueabi/usr/include/**",
    "~/sdk/sysroots/hoge-linux-gnueabi/usr/include/hige/include/**"
 ],

優先したいヘッダが ${workspaceFolder}/include/fuge/myheader.h にあるけど ** があるのに見つけてくれない時は "${workspaceFolder}/include", のように指定しろと C/C++: Log Diagnostics がアドバイスしてくれるので言われた通りにする。

(どこで調べたのか忘れてしまったので参照省略)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?