LoginSignup
0
1

More than 5 years have passed since last update.

VS Codeで、C/C++のライブラリのincludeに緑色の線がつかないようにする(include失敗しないようにする)

Posted at

環境

Windwos 10
VS Code
MinGW

問題点

image.png

上の画像のように、includeの部分に緑色の下線がつくことがある。
これは、includeするファイル(写真の場合だと、windows.h, math.h, time.h, stdio.h, stdlib.h)が見つからないというエラーが原因。

拡張機能無効で起動したところ、問題はなかったので、C/C++関係の拡張機能が原因だが、特定はしていない。

解決方法

カーソルを合わせると、黄色のはてなマークがでるので、それをクリックして、「Edit "includePath" setting」を押す。
image.png
そうすると、上の写真のような画面が出てくるので、"includePath"の中に、MinGWのincludeフォルダを書き加える。
image.png
これによって、MinGWの中にあるヘッダファイルを参照することができる。

別解

windows.hなどは、Microsoft SDKsの中に入っているという記事をいくつか見つけたが、そちらはwindows.hが見つからなかったので断念した。

0
1
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
1