microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.51k stars 1.55k forks source link

#include file not found in browse path #969

Closed weinand closed 5 years ago

weinand commented 7 years ago

From @sophoc8 on August 12, 2017 0:45

Extension Author (truncated) Version
vscode-docker Pet 0.0.16
python don 0.7.0
code-runner for 0.6.33
vscode-clang mit 0.2.2
cpptools ms- 0.12.2
vscode-autohotkey sle 0.2.1
vim vsc 0.9.0

Steps to Reproduce:

1. 2.

Reproduces without extensions: Yes/No

Copied from original issue: Microsoft/vscode#32358

nick-korsakov commented 7 years ago

The same issue for or any standard header files. VSCode 1.15.0. OS: Linux 4.4.0-91. Extensions: "ms-vscode.cpptools", "twxs.cmake", "vector-of-bool.cmake-tools", "maddouri.cmake-tools-helper".

c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "proj / proj / Debug",
            "includePath": [
                "/home/user/proj/include"
            ],
            "defines": [],
            "browse": {
                "path": [
                    "/home/user/proj/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 2
}

P.S.: Project compiles and runs well.

sean-mcmanus commented 7 years ago

@sophoc8 @nick-korsakov There's a bug in 0.12.2 that causes files with non-ASCII file paths to not be found, so maybe that is causing this? The features should work in general though. We may need more repro details.

nick-korsakov commented 7 years ago

There is no non-ASCII paths on my system. stdio.h was not found by VSCode but located at /usr/include.

sean-mcmanus commented 7 years ago

@nick-korsakov What is the size of your .browse.vc.db file? Can you try changing the databaseFilename to "${workspaceRoot/.vscode/vc.db"? Is there a red flame in the bottom right? After closing VS Code, can you make sure to kill any dangling Microsoft.VSCode.CPP.Extension.linux processes? Have you tried switching your intelliSenseEngine to "Default"? That will start to use the non-recursive includePath setting instead, but you might have other issues. Myself and others are able to go to definition for stdio.h on Linux, so something unusual is happening.

KaoCC commented 7 years ago

Same thing happened here. I can second this issue.

justClouds commented 7 years ago

I am having the same issue on Windows 10 Build 16281 with VS Code 1.16. "Include errors detected. Please update your include path". But the c_cpp_properties.json contains the full path of the include file that cannot be found. And there are no non-ASCII characters in the path. This is a fresh install of VS Code (after deleting the .vscode directory as well) and just a few extensions installed.

ristomatti commented 7 years ago

I am experiencing this issue with PlatformIO extension (which uses the C++ extension). All the #include lines causing the false error seem to be part of the standard library. Like #include <functional> or #include <memory>.

sean-mcmanus commented 7 years ago

@justClouds If your paths end with *, the search for include directories won't be recursive. Can you share any other repro details? I'm not able to repro this problem.

@ristomatti What OS are you on? What is your browse.path? What is the error exactly? Is it "#include file not found in browse path"? It sounds like you need to add paths to the browse.path setting in c_cpp_properties.json.

justClouds commented 7 years ago

I have no '*' in the include paths. This is my c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/cores/esp8266",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/variants/d1_mini",
                "c:/projects/sensor-p1/src",
                "c:/projects/sensor-p1/.piolibdeps/Time_ID44",
                "c:/projects/sensor-p1/.piolibdeps/PubSubClient_ID89/src",
                "C:/Users/RonMoerman/.platformio/lib/ArduinoJson_ID64/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/SoftwareSerial",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPClient/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266mDNS",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ArduinoOTA",
                "c:/projects/sensor-p1/.piolibdeps/PubSubClient_ID89/src",
                "c:/projects/sensor-p1/.piolibdeps/PubSubClient_ID89/src",
                "c:/projects/sensor-p1/.piolibdeps/Time_ID44",
                "c:/projects/sensor-p1/.piolibdeps/Time_ID44",
                "C:/Users/RonMoerman/.platformio/lib/Adafruit Unified Sensor_ID31",
                "C:/Users/RonMoerman/.platformio/lib/ArduinoJson_ID64/src",
                "C:/Users/RonMoerman/.platformio/lib/ArduinoJson_ID64/src",
                "C:/Users/RonMoerman/.platformio/lib/DHT sensor library_ID19",
                "C:/Users/RonMoerman/.platformio/lib/NtpClientLib_ID727/src",
                "C:/Users/RonMoerman/.platformio/lib/PubSubClient_ID89/src",
                "C:/Users/RonMoerman/.platformio/lib/Time_ID44",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ArduinoOTA",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/DNSServer/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/EEPROM",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266AVRISP/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPClient/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPUpdateServer/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266SSDP",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WebServer/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFiMesh/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266httpUpdate/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266mDNS",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/Ethernet/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/GDBStub/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/Hash/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/SD/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/SPI",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/Servo/src",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/SoftwareSerial",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/SoftwareSerial",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/TFT_Touch_Shield_V2",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/Ticker",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/Wire",
                "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/esp8266/src",
                "C:/Users/RonMoerman/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include",
                "C:/Users/RonMoerman/.platformio/packages/toolchain-xtensa/lib/gcc/xtensa-lx106-elf/4.8.2/include",
                "C:/Users/RonMoerman/.platformio/packages/toolchain-xtensa/lib/gcc/xtensa-lx106-elf/4.8.2/include-fixed",
                "C:/Users/RonMoerman/.platformio/packages/tool-unity",
                ""
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": "",
                "path": [
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/cores/esp8266",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/variants/d1_mini",
                    "c:/projects/sensor-p1/src",
                    "c:/projects/sensor-p1/.piolibdeps/Time_ID44",
                    "c:/projects/sensor-p1/.piolibdeps/PubSubClient_ID89/src",
                    "C:/Users/RonMoerman/.platformio/lib/ArduinoJson_ID64/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/SoftwareSerial",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPClient/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266mDNS",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ArduinoOTA",
                    "c:/projects/sensor-p1/.piolibdeps/PubSubClient_ID89/src",
                    "c:/projects/sensor-p1/.piolibdeps/PubSubClient_ID89/src",
                    "c:/projects/sensor-p1/.piolibdeps/Time_ID44",
                    "c:/projects/sensor-p1/.piolibdeps/Time_ID44",
                    "C:/Users/RonMoerman/.platformio/lib/Adafruit Unified Sensor_ID31",
                    "C:/Users/RonMoerman/.platformio/lib/ArduinoJson_ID64/src",
                    "C:/Users/RonMoerman/.platformio/lib/ArduinoJson_ID64/src",
                    "C:/Users/RonMoerman/.platformio/lib/DHT sensor library_ID19",
                    "C:/Users/RonMoerman/.platformio/lib/NtpClientLib_ID727/src",
                    "C:/Users/RonMoerman/.platformio/lib/PubSubClient_ID89/src",
                    "C:/Users/RonMoerman/.platformio/lib/Time_ID44",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ArduinoOTA",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/DNSServer/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/EEPROM",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266AVRISP/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPClient/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPUpdateServer/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266SSDP",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WebServer/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFiMesh/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266httpUpdate/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266mDNS",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/Ethernet/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/GDBStub/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/Hash/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/SD/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/SPI",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/Servo/src",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/SoftwareSerial",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/SoftwareSerial",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/TFT_Touch_Shield_V2",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/Ticker",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/Wire",
                    "C:/Users/RonMoerman/.platformio/packages/framework-arduinoespressif8266/libraries/esp8266/src",
                    "C:/Users/RonMoerman/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include",
                    "C:/Users/RonMoerman/.platformio/packages/toolchain-xtensa/lib/gcc/xtensa-lx106-elf/4.8.2/include",
                    "C:/Users/RonMoerman/.platformio/packages/toolchain-xtensa/lib/gcc/xtensa-lx106-elf/4.8.2/include-fixed",
                    "C:/Users/RonMoerman/.platformio/packages/tool-unity",
                    "",
                    "${workspaceRoot}"
                ]
            },
            "defines": [
                "ARDUINO=20300",
                "LWIP_OPEN_SRC",
                "F_CPU=80000000L",
                "__ets__",
                "ICACHE_FLASH",
                "PLATFORMIO=30500",
                "ESP8266",
                "ARDUINO_ARCH_ESP8266",
                "ESP8266_WEMOS_D1MINI",
                ""
            ],
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 3
}

When opening the main.cpp file I also get the following message: "Configure includePath for better IntelliSense results.". But all the include paths are in there...

sean-mcmanus commented 7 years ago

@justClouds Oh, you're using Arduino. You might try using the Arduino extension by Microsoft, which has a dependency on us (and/or asking them how to set things up for Arduino usage). I think your intelliSenseMode should be "clang-x64" not "msvc-x64". You can also change the intelliSenseEngineFallback setting to "Disabled" if you can't get all the paths set correctly. What include file does it say is missing and what is the path it's located at?

ristomatti commented 7 years ago

@sean-mcmanus Sorry I had missed your question until now. I'm running Linux (Ubuntu 16.04 based distribution).

The files I get the warnings are (recursively) under paths listed on c_cpp_properties.json browse path. I've tried adding the exact paths and but it didn't fix the warnings. I've also tried adding the direct paths to the files as a longshot but that did not help either.

Also I am able to find the "missing" files by just ctrl+click. This would to me indicate the files are in the browse path.

Any file that has a direct or indirect #include for these extensionless standard library files gives the warning. If there's some way I can provide more useful info for debugging purposes just let me know!

ristomatti commented 6 years ago

I no longer experience this issue with the latest Visual Studio Code and C/C++ extension.

bobbrow commented 5 years ago

I'm closing old issues marked "more info needed". If you are still having issues with the extension, please ensure you have installed the latest version and open a new issue with the issue details.

If you are having trouble getting system includes to resolve, please remove any system include paths from includePath and set the compilerPath property in c_cpp_properties.json instead.