Flow Flow - 2 months ago 223
C Question

Visual Studio Code include file not found in include directory (Windows 10)

I am trying to get intellisense in Visual Studio Code. I downloaded the the C/C++ extension from the marketplace: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools and also installed MinGW with the packages

mingw32-base
and
mingw32-gcc-c++
. I added the MinGW
bin
folder to
Path
in my Environment variables.

When I add any
include
statement in my
.c
file, such as
#include <stdio.h>
, Visual Studio Code says:

Include file not found in include directory


Am I not configuring correctly? How can I get intellisense for C/C++?

Answer

You have to create a c_cpp_properties.json first (use Ctrl+Shift+P and "C/Cpp: Edit Configurations" command).

Add inlude paths as,

{
  "configurations": [
    {
      "name": "Win32",
      "includePath": [
        "path_to_your/MinGW/lib/gcc/mingw32/4.8.1/include/c++"
      ],
      "browse": {
        "limitSymbolsToIncludedHeaders": true,
        "databaseFilename": ""
      }
    }
  ]
}
Comments