PlatformIO: 'BUILTIN_SDCARD' was not declared in this scope

Hey All,

I have been having difficulties with PlatformIO and Teensy 4.1 lately. I solved some of my issues by reinstalling Windows, but now I am having other problems.

- When compiling my code, I get the following error: "'BUILTIN_SDCARD' was not declared in this scope." When using the SD.h library that I installed. I thought the Teensy used a special SD.h, but I can't find it.

- I've re-installed Teensyduino and the Arduino IDE 2 and 1.

- The code compiles and uploads in the Arduino IDE 2 and 1 without issue.

- I was previously getting the following error: "Teensy's SD library uses a custom modified copy of SdFat. Standard SdFat was mistakenly used. Arduino should print multiple libraries found for SdFat.h. To resolve this error, you will need to move or delete the copy Arduino is using, or otherwise take steps to cause Teensy's special copy of SdFat to be used."

Any help would be greatly appreciated! I really don't want to switch from PlatformIO to either of the IDEs... PIO is much faster to work with.

I thought the Teensy used a special SD.h, but I can't find it.

Yes, Teensy uses a special SD library which is really just a thin wrapper for SdFat. Teensy also uses a customized copy of SdFat. Normally these are supposed to come automatically with the platform, at least when using Arduino IDE. Can't say how PlatformIO works. But I can give you links to both libraries on github.

If you have installed Arduino IDE 1.8.19 and Teensyduino 1.57, these libraries should be in {Arduino}/hardware/teensy/avr/libraries. Or if using MacOS, control-click Teensyduino and look in Contents/Java for the hardware/teensy/avr/libraries folder.