Arduino ESP32 can find SPI.h from main file but not from dependent libraries

Hello,

I’m pulling my hair here with trying to compile RadioLib in a project of mine with the following in main.cpp file:

#include <SPI.h>

And it compiles just fine. If I ctrl-click on it, it opens this file:

C:\Users\obones\.platformio\packages\framework-arduinoespressif32\libraries\SPI\src\SPI.h

But a few seconds later, when it tries to compile a dependency file, I get these errors:

In file included from .pio/libdeps/ESP32_WROOM32D/RadioLib/src/Module.cpp:1:
.pio/libdeps/ESP32_WROOM32D/RadioLib/src/Module.h:9:12: fatal error: SPI.h: No such file or directory

In file included from .pio/libdeps/ESP32_WROOM32D/RadioLib/src/hal/Arduino/ArduinoHal.cpp:1:
.pio/libdeps/ESP32_WROOM32D/RadioLib/src/hal/Arduino/ArduinoHal.h:16:10: fatal error: SPI.h: No such file or directory

In file included from .pio/libdeps/ESP32_WROOM32D/RadioLib/src/modules/CC1101/CC1101.h:5,
                 from .pio/libdeps/ESP32_WROOM32D/RadioLib/src/modules/CC1101/CC1101.cpp:1:
.pio/libdeps/ESP32_WROOM32D/RadioLib/src/modules/CC1101/../../Module.h:9:12: fatal error: SPI.h: No such file or directory

And the last one is repeated for quite a few files.
What’s really weird is that if I open the file where the error is reported and use ctrl-click on <SPI.h>, VSCode opens the exact same file as in main.cpp

This also happens with other libraries, RadioHead for instance.

I have created a minimalist project that reproduces the situation on my end: GitHub - obones/arduino_spi: Meant to illustrate only, not real code · GitHub

I’m convinced this is an issue with my installation, but I can’t find what’s wrong with it.

Any help is greatly appreciated.

What happens with deep+ and chain+?

Thanks for your reply.

deep+ did not change a thing but chain did, with or without the + sign.

Strange thing is that I have been using deep for ages but that was on projects a few years back. Now that I’m back, it seems things have changed but that’s fine.

Once again, thanks for your help