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++?
Try reinstalling mingw. Basically, the problem is with header files. I think you should try reinstalling mingw, adding it to system path again or try installing the extension in vscode. Hope this helped.
Launch VS Code. Open the Command Palette (Cmd+Shift+P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.
Open VSCode application or open a new VSCode window if the current session is to be preserved. Navigate to "Open Folder", either via File menu or Ctrl + K + O. Navigate to the folder and select it for opening.
On Fedora linux I added the following path where all my c header files lives.
/usr/include/**
to myc_cpp_properties.json file.
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/**"
],
...
}
],
"version": 4
}
First, make sure to create a c_cpp_properties.json
file in your .vscode
folder
Hint: Use the Command Palette (Ctrl+Shift+P) and type C/Cpp: Edit Configurations
Add include paths like this:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"path_to_your/MinGW/lib/gcc/mingw32/4.8.1/include/c++"
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With