Build fails for Itsybitsy nrf52840 when adding bluefruit.h

Have been trying to get ble examples working through platformio on our board but have had no luck. The moment I add bluefruit.h as a header the build fails with lots of errors like the following

C:\Users\Jonathan.platformio\packages\framework-arduinoadafruitnrf52\libraries\Bluefruit52Lib\src\utility\bonding.cpp:221:10: error: ‘file’ was not declared in this scope

All related to bonding.cpp

Even with a very minimal setup this occurs. Here is .ini contents

[env:ble-test]
platform = nordicnrf52
board = adafruit_itsybitsy_nrf52840
framework = arduino

And here is the most basic code that fails at compiling.

#include <Arduino.h>
#include “Adafruit_TinyUSB.h”
#include “bluefruit.h”
void setup(){};
void loop(){};

This code does compile in the arduino ide so I’m not sure what I’m doing wrong, if there is a missing setting in the .ini, or if this is a platformio bug.

Alright, solved it, kind of?

This was due to a namespace collision with the ‘File’ class between the “Adafruit_LittleFS” library and the “SdFat - Adafruit Fork” libraries in my libdep folder.

After realizing this (and not knowing exactly how or why SdFat library got included ever), deleting the .pio folder and running a clean build resolved the issue.

Keeping topic up in the chance somebody else runs into this and also forgets to try a clean build first.