Compilation error 328pb program

Hello. I used to program with arduno IDE, so I’m not at ease, for the moment, with platformIO.
Can somehone help me solving this compilation problem ?

thanks !

  1. Delete the .pio folder in the project and rebuild
  2. If that doesn’t help: The paths may be getting too long and you might to enable Win32 Long Paths.

Hello.
Thanks for your response;

After enabled long name, still two error now

Are you sure you rebooted your computer after enabling it?

Yes, I did it, and verified all

Delete C:\Users\PC\.platformio full, restart VSCode, compile again.

I did it, but it doesn’t work

The strange thing is that it compiles without error when I use arduino IDE

But compiling a simple blinky example works, with no libraries in lib_deps?

It works when I compile without using the adrafruit library

I also tried to add libs deps, but still don’t work

image

It finally works with addind #include <SPI.h>

The explanation is :

Because this works around a platformio dependency scanning bug . When you are using a library that depends on the Adafruit BusIO library, the pio dependency scanner is confused by a C preprocessor guard that guards an #include <SPI.h> there:

#if !defined(SPI_INTERFACES_COUNT) ||                                          \
    (defined(SPI_INTERFACES_COUNT) && (SPI_INTERFACES_COUNT > 0))

#include <SPI.h>

During compilation, when targeting a standard Arduino board, the guard evaluates to true such that the compiler wants to include that header - but platformio hasn’t provided it.

So adding a plain #include <SPI.h> in your own code works around this issue because the pio dependency scanner picks up the dependency that way then. Alternatively, and arguably a cleaner work around is to simply add an SPI line to the lib_deps directive in your platformio.ini.

Founded here https://community.platformio.org/t/adafruit-busio-adafruit-spidevice-h17-fatal-error-spi-h-no-such-file-or-directory/14864/8

Thank you for taking the time to answer me @maxgerhardt