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 !
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 !
.pio
folder in the project and rebuildAre 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
?
I also tried to add libs deps, but still don’t work
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.
Thank you for taking the time to answer me @maxgerhardt