This is an error regarding the INO preprocessing. Your example works by simply renaming SAMD21.ino
-> SAMD21.cpp
.
I had a look at the pre-processor output of the file and it definitely looks weird. (Add -E
to the build_flags
, run pio run -e samd21b
and open .pioenvs\samd21b\src\SAMD21.ino.cpp.o
). It does a function declaration but without ever including the header file for it…
void emptyFun();
void displaySensorOffsets(adafruit_bno055_offsets_t &calibData); //no #include "Adafruit_BNO055.h" before this or the content of the header file!
void setup();
void loop();
# 5 "C:/Users/Maxi/Desktop/platformio-build-flags-error/src/SAMD21.ino"
void emptyFun() {
}
# 29 "C:/Users/Maxi/Desktop/platformio-build-flags-error/src/SAMD21.ino"
void setup() {
}
void loop() {
}
This also happens regardless of adding lib_ldf_mode = chain+
or deep
or lib_deps = Adafruit_BNO055
.