I was working on trying out how to save .bin file in external EEPROM with Arduino Nano described in my post how to write a bin file to the EEPROM using Arduino? . When I compiled I forgot that I had to use SD library and I got compiling error as follows:
.. fatal error: SD.h: No such file or directory means that the Arduino IDE
The error you're seeing:... fatal error: SD.h: No such file or directory means that the Arduino IDE cannot find the SD library.
Here's how to fix it step-by-step:
✅ Step 1: Install the SD Library
-
Open Arduino IDE.
-
Go to the menu bar:
Sketch → Include Library → Manage Libraries... -
In the Library Manager, search for “SD”.
-
Find the official “SD” library by Arduino and click Install.
✅ Step 2: Check Your Board and SPI Pins
Make sure:
-
You're using an SD card module with proper wiring:
-
CS
to pin 10 (or another pin if you define it) -
MOSI
to D11 -
MISO
to D12 -
SCK
to D13
-
-
Board selected is Arduino Nano (Tools → Board → Arduino AVR Boards → Arduino Nano)
✅ Step 3: Verify Again
After installing the SD library and wiring correctly:
-
Restart the IDE if needed.
-
Try compiling again — the error should be gone.
The error should be gone as shown below.