compiler not finding files

Just received a Due and an ILI9341 2.8" TFT a week ago, and then discovered MareckB’s great library of DMA enhanced SPI utilities. I have played with most of the examples that he provided, without a hitch. Unfortunately, the most important example to me has stubbornly refused to compile. The example is sdFatTftBitmap, in the ILI9341 examples folder of mareck buriak’s github page.

C:\Users\Gary\Documents\Arduino\libraries\ILI9341_due\examples\sdFatTftBitmap\sdFatTftBitmap.ino:19:19: fatal error: SdFat.h: No such file or directory

 #include <SdFat.h>


compilation terminated.

Using library SPI at version 1.0 in folder: C:\Users\Gary\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\libraries\SPI 
exit status 1
Error compiling for board Arduino Due (Programming Port).

Here is just the top of the example sketch causing the problem-

#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <ILI9341_due_config.h>
#include <ILI9341_due.h>

#define TFT_RST 8	// uncomment if you have ILI9340
#define TFT_DC 9	// Command/Data for LCD
#define TFT_CS 10	// Chip Select for LCD

#define SD_CS 4		// Chip Select for SD card

#define BUFFPIXELCOUNT 160	// size of the buffer in pixels

I posted about this problem a few days ago in MareckB’s 3year old thread (ILI9341-due) that now hasn’t been posted to in a few months, but received no response, and that post has fallen off the top page, so I hope starting a new thread about the same subject, here, isn’t considered cross-posting.

I have been digging and digging into this, but nothing so far. I tried moving the SD library into my sketch library folder and using full file-path names for the header files. I’ve re-installed the Arduino IDE twice, and made countless other attempts to no avail. It just seems that I am missing something basic, here, about the Arduino IDE library structure. I couldn’t remember if I manually installed the ILI9341_due library or not, so I deleted it and let the IDE install it from the github zip file… and nadda. In fact, the automatic install called the library ‘ILI9341_due-master’, which violates what I thought were two basic rules of the library system- 1. the folder name doesn’t match the header name, and 2. the folder name contains the illegal symbol ‘-’.

I’ll keep digging until I get this, but if anyone can point me in a better direction, I would greatly appreciate it.


This library is based on 3 libraries:

ili9341_t3 from Paul Stoffregen -
SdFat from Bill Greiman - GitHub - greiman/SdFat: Arduino FAT16/FAT32 exFAT Library

That made me suspect that the greiman/SdFat was a dependency, though the documentation doesn’t state that.

After installing the greiman/SdFat library, the error about SdFat.h no longer occurred but now it complains that SdFatUtil.h is missing. That file is not part of the greiman/SdFat library. It is part of the stock SD library (in the utility subfolder) but including the SD library in order to make that file accessible causes a new error. So I tried just commenting line 20 of the sketch:

#include <SdFatUtil.h>

and now it compiles! I can’t say whether it actually works

This is all very confusing due to the fact that the stock SD library contains a file named SdFat.h and one named SdFatUtil.h but neither contains a class named SdFat and the greiman/SdFat library does so I think that is the intended library. The moral of the story is that library authors should take a tiny extra bit of time to provide good documentation so that their work can actually be used without a ton of hassle.

Oh, thank you so much, pert, I have followed your posts and am honored that you took the time to help me. I also noticed his comment about the three libraries, and tried to install all three, with only the first two being available to install. But then, it is your commenting of the #include statement of the SdFatUtil header that I hadn't tried. Thank you, so much.

Right now, I will have to reinstall those two libraries, since I have reinstalled the IDE, and will have to wait to actually run the example, because my hardware is currently being converted into a hard wired shield instead of the breadboard mangle I had earlier (waiting overnight for the epoxy to cure). I am convinced already, though, that your advice will fix it, but will report back tomorrow when I can go for the eureka...

Yes... it compiles perfectly, pert. Looking forward to going forward on my sous vide project, tomorrow.

No joy in Mudville, I'm sorry to report. The sdFatTftBitmap example in the ILI9341_due library just refuses to successfully initialize the sd card. I tried re-including the SdFatUtil.h file and eventually found that copying that header file from the SD\src\util folder into the SdFat\src folder in my library folder also allowed the example code to compile, yet still wouldn't successfully initialize the sd card.

I believe my hardware to be correct, since many example programs that read, write, and even datalog to the SD card run flawlessly, including, of course, initialization.

EDIT- Never mind, I'm just going to go with the WeMos D1 @$5 a pop, instead of the DUE @$15. It has 4 megs of flash program memory, 3.3v i/o, WiFi, 160 Mhz clock, and I can just keep several full resolution 24-bit bitmaps in its flash memory. The sd card on the display can datalog, or whatever... thanks for the help, and please don't hesitate to comment about the ILI9341, DUE, or WeMos, if anyone has any input.