Intellisenseinstructions inconsistent with what is actually there and can't find existing files

I am trying to sort out a number of include issues that are a pain. It keeps telling me it can’t find files that are there. Went to the help and the instructions appear to have no connection with reality. On the page:

it states there is a ligh tbulb. Never there. Go to the
Hovering over the green squiggle produces "cannot open the source file ;…
For example all of these

#include “soc/rtc_cntl_reg.h”
#include “esp_wifi.h”
#include “esp_system.h”
#include “nvs_flash.h”
#include “esp_event_loop.h”
#include “freertos/FreeRTOS.h”
#include “freertos/task.h”
#include “freertos/semphr.h”
#include “freertos/queue.h”

as well as
#include “HTU21D.h”

#include “MCP9808.h”
which are in the include directory
If I examine c_cpp_properties.json I can find the correct paths and have verified that the files are indeed there
for example
#include “driver/i2c.h” produces a can’t find yet it is where it should be
given the line in c_cpp_properties
I have tried <> instead of “”“” and / as well as \

They all produce
#include errors detected. Please update your includePath. IntelliSense features for this translation unit (D:\Development\PIOProjects\esp32\ESP32Workspace01\HTU21DMCP9808Dual\src\HTU21DMCO9808Test.c) will be provided by the Tag Parser.

cannot open source file “driver/i2c.h”






  • 1: Task - PlatformIO: Clean (HTU21DMCP9808Dual)2: Task - PlatformIO: Build (HTU21DMCP9808Dual)

since the path is already there i am at a loss as to how to proceed. This also true true for the files in the include directoryu for the program even though c_cpp_properties points to the directory

it is able to find things like stdlib.h and the other standard c headers.

Did a clean, vscode exit, restart recompile. Still can’t find files Terminal window shows
Retrieving maximum program size .pioenvs\esp32thing\firmware.elf
Building .pioenvs\esp32thing\firmware.bin
Checking size .pioenvs\esp32thing\firmware.elf
Memory Usage → Redirecting...
DATA: [ ] 3.8% (used 12500 bytes from 327680 bytes)
PROGRAM: [== ] 15.8% (used 165581 bytes from 1048576 bytes)
======================================================= [SUCCESS] Took 61.70 seconds =======================================================
Problems shows a count of 14

What am i missing?

Please don’t edit includes directly in c_cpp_properties.json and use build_flags option in platformio.ini instead.

Thanks for the quick response. I am not editing the c_cpp_properties file as the inmcludes appear to be in it already. It still tells me it can’t open the file. On the other hand the program compiles without werror and executes, even with the list of unfindable files. The files are evidently being found as I am using defines and other information in them in my program. Maybe I have misconfigured intellisese somehow? or …
Where else can I look?

Further study produced an unexpected result. The screenshot below has all of the information to look at.
The directory to look at is the include directory. In it are two files of interest MCP9808.h in the leftpane and SENSORI2CDEFS.h
in the right pane.
in MCP9808.h #include “driver\i2c.h” is not flagged as unfindable in SENSORI2CDEFS.h it is. There is a green squiggle and a popup. These two files are in the same directory in the same project in the same workspac e yet in one case the file is found, expected when c_cpp-properties.json is examined line 59 in mine is
with the include statement
#include “driver\i2c.h”
this expands to
and the file is there.
I must be missing something
Thanks for your help


Could you try to change slash to /?

#include "driver/i2c.h"

Did a clean and build with it both ways, exactly the same result. What is surprising is that the problem window shows it as driver\i2c.h no matter which \ or / I use in the source code. Something is not getting updated

#include errors detected. Please update your includePath. IntelliSense features for this translation unit (D:\Development\PIOProjects\esp32\ESP32Workspace01\HTU21DMCP9808Dual\src\MCP9808.c) will be provided by the Tag Parser.

cannot open source file “driver\i2c.h”

This is with #include “driver/i2c.h” in the code

Curiouser and curiouser

  1. Please open PIO IDE Terminal and type
pio upgrade --dev
  1. Remove .vscode folder from a project
  2. Restart VSCode.

Does it work now?

That did it. Thank you very much