BUILTIN_SDCARD Not defined

Status
Not open for further replies.

FredBloggs

New member
Posting in case this is helpful to someone else.

I installed Ardruino 1.8.13 and teensy installer but whenver i tried to compile any of the Teensy 4.1 example to use built in SD, I got BUILTIN_SDCARD Not defined error.

To Diagnose:

1. I enabled Ardruino > Preferences > Show verbose Output during compilation.

2. I could see that even though I has selected: Tools > Board: Teensy 4.1
That compilation was including the SD library for the standard 'arduino' hardware and not the 'teensy' hardware folder.

3. I'm not sure of the exact steps which fixed this but I tried the following until compilation finally included the correct teensy hardware and resolved the BUILTIN_SDCARD Not defined error.

a. Deleted all Ardruino Cache folders.
b. Re- Started Ardruino IDE.
c. Switched order of #include SPI with SD.
d. Re compiled. at some point after doing the above I could see the compiler verbose logging showed that it choose the teensy SD library over the standard ardruino hardware SD libraru
 
You probably have a copy of SD in {Documents}/Arduino/libraries. Anything you put there will override everything else. It's a powerful feature meant to allow you to play with editing library code. But sometimes it gets used to solve a specific problem, and then that "solution" is forgotten until it interferes with other boards many months or years later. Since it's in your Documents folder, it persists even when you reinstall Arduino and Teensyduino.

Arduino should give you info about which libraries it actually used and which it ignored. Maybe copy that info here if it's not clear.
 
Thanks for prompt response PaulStoffregen, I tried googling for Ardruino build process to see how it determines which libs to use, but did not find anything helpful.

This info you provided here is very helpful and most likely the case as I forgot to mention that in my attempts to get the compiler to use the teensy version of SD, I also deleted that folder, then got some error about missing
libraries, so re-downloaded just the minimal that i needed.

Thanks again, I will add a comment note to my future teensy projects with this detail. :)
 
As I found out recently, it's possible to create "portable" subdirectory in Arduino directory and it'll use it for everything (sketches, libraries and boards). But it might not work with installed version (not without changing write permissions in Program Files)
 
Status
Not open for further replies.
Back
Top