Cell
Cell

Reputation: 191

VS code: include file not found in browse. path.?

IN VS CODE i get the error "include file not found in browse. path." with an error squiggle under my header file #include <stdio.h> how can i make this library accessible to my code.

all i have is a folder and a main.c file

Very new to all this, the other answers seem to be out of my depth as im not sure what files they're accessing. Thank you in advance.

Upvotes: 10

Views: 49423

Answers (4)

user26674931
user26674931

Reputation: 1

Follow these steps:

  1. OPEN FILE EXPLORER
  2. THIS PC
  3. Go to drive
  4. Open extension
  5. Click include and copy include path
  6. Open settings in vs code and search browse.path
  7. C_Cpp › Default › Browse: Path ,this will show up
  8. paste that include path in "add item"

Upvotes: 0

Deb
Deb

Reputation: 663

All you need to have is, to check if browse.path exists in the c_cpp_properties.json file. If not include this part. It should fix the issue.

   {
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "gnu11",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "gcc-x64",
            "browse": {
                "path": ["${workspaceFolder}"],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
              }
        }
    ],
    "version": 4 }

Upvotes: 4

George Trifonov
George Trifonov

Reputation: 1991

Attaching example of .vscode\c_cpp_properties.json file with browse.path which solved my issues with Arduino dependencies

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:\\Users\\localuser\\Documents\\Arduino\\libraries\\AzureIoTProtocol_MQTT\\src\\**",
                "C:\\Users\\localuser\\Documents\\Arduino\\libraries\\AzureIoTUtility\\src\\**",
                "C:\\Users\\localuser\\Documents\\Arduino\\libraries\\AzureIoTHub\\src\\**",
                "C:\\Users\\localuser\\Documents\\Arduino\\libraries\\WiFiManager\\**",
                "C:\\Users\\localuser\\Documents\\Arduino\\libraries\\ArduinoJson\\**",
                "C:\\Users\\localuser\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\**",
                "C:\\Users\\localuser\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.2\\**",""
            ],
            "forcedInclude": [],
            "browse": {
                "path":[
                    "C:\\Users\\localuser\\Documents\\Arduino\\libraries\\AzureIoTProtocol_MQTT\\src\\**",
                    "C:\\Users\\localuser\\Documents\\Arduino\\libraries\\AzureIoTUtility\\src\\**",
                    "C:\\Users\\localuser\\Documents\\Arduino\\libraries\\AzureIoTHub\\src\\**",
                    "C:\\Users\\localuser\\Documents\\Arduino\\libraries\\WiFiManager\\**",
                    "C:\\Users\\localuser\\Documents\\Arduino\\libraries\\ArduinoJson\\**",
                    "C:\\Users\\localuser\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\**",
                    "C:\\Users\\localuser\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.2\\**"]
            },
            "intelliSenseMode": "msvc-x64",
            "compilerPath": "C:\\WinAVR-20100110\\bin\\avr-gcc.exe",
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

Upvotes: 6

Mark A. Ropper
Mark A. Ropper

Reputation: 425

Very similar problem to the one posed here, and thankfully a very similar solution.

Ctrl-Shift-P will open the "command bar", start trying C/Cpp: Edit Configurations until it's the top result then hit enter, this will create a c_cpp_properties.json file in the .vscode folder of your current project directory (making this configuration unique to this project, so you'll need to repeat this for other projects). This json file has sections for Mac, Linux and Win32, edit the section relevant to you or all if you know the paths for the other platforms. Each block has a name, includePath, defines, intelliSenseMode and browse property. The browse property has a child array called path (which is what we're looking for, include file not found in *browse.path*), add the paths to your include directories here, one string each, and remember to use forward slashes even if Windows gives you them as backward slashes.

While the offending error disappeared when adding the correct path to browse.path, I also added it to the includePath section because according to the hover tooltip includePath is used by the intellisense engine whereas browse.path is used by the tag parser. Can't hurt to have both set up correctly.

Upvotes: 10

Related Questions