SD library issues

snowsh

Well-known member
So I decided to have a look at Arduino ide 2. I checked to see if I could run the new version 2 alongside my original Arduino (1.8.15) Teensyduino 1.54 - results said yes and that my libraries would remain intact. I dont think that is entirely true as the install seems to have updated all the libraries too...

At first glance I was impressed with the new features. Then I tried to compile a project I have been working on for over a year. I compiled fine before.....

Now I get the dreaded SD library problems, in both versions of Arduino IDE.......

error: #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."
#error "Teensy's SD library uses a custom modified copy of SdFat.

full error:
Code:
In file included from C:\Users\nxx\OneDrive\Documents\Arduino\projects\ASeqCII project\ASeqCII_V1.010-resume-scotland-20092022\ASeqCII_V1.010-resume-scotland-20092022.ino:36:0:
C:\Users\nxx\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.57.0\libraries\SD\src/SD.h:29:2: error: #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."
 #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."
  ^
Multiple libraries were found for "SdFat.h"
 Used: C:\Users\nxx\OneDrive\Documents\Arduino\libraries\SdFat
 Not used: C:\Users\nxx\OneDrive\Documents\Arduino\libraries\arduino_468653
 Not used: C:\Users\nxx\OneDrive\Documents\Arduino\libraries\SdFat_-_Adafruit_Fork
 Not used: C:\Users\nxx\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.57.0\libraries\SdFat
Multiple libraries were found for "SD.h"
 Used: C:\Users\nxx\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.57.0\libraries\SD
 Not used: C:\Program Files (x86)\Arduino\libraries\SD
Error compiling for board Teensy 4.1.

For further detail, I include the SD lib like this:

Code:
#include <SD.h>

and I startup the SD using a function:

Code:
void mySdBegin()                                                          // begin new SD connection
{
  cardStatus = SD.sdfs.begin(SdioConfig(FIFO_SDIO));
  if (!cardStatus)
  {
    Serial.println(F("SD card not present"));
    delay(2000);
  }
}

I have looked at the src for the used version of SD...

Code:
#if !defined(SD_FAT_TEENSY_MODIFIED)
#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."
#endif

So to track down which SDFat.h its actully hunting, I searched my drive for "SD_FAT_TEENSY_MODIFIED" - nothing! A quick google search for "SD_FAT_TEENSY_MODIFIED" returns only one result, the github page for the SD.h it is using.....

There must be a better way of dealing with these library includes than relying on the IDE to hunt down "the best choice"....

I am stumped. I want to write code, not troubleshoot installations! Arrghh!

So, which exactly is "Teensy's special copy of SdFat"??

Help!
 
Last edited:
It is the one installed by Teensyduino and/or Board Manager - depending on which one.

For example, my IDE2 has it installed at: C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.58.0-beta2\libraries

Teensyduino install for IDE1, will be in wherever your IDE was installed: <ide>/hardware/teensy/avr/libraries
 
well i sorted it by reinstalling teensyduino and removing all the other instances of SD and SDFat. guess I will have to reinstall these libs if I use a nano etc.....
 
Back
Top