Problem with Adafruit_ImageReader library

Hello!

I've just started using a adafruit 2.8" display. But I get an error when I try to include the Adafruit ImageReader library.

"Multiple libraries were found for "Adafruit_ImageReader.h"
In file included from C:\Users\fredr\Documents\Arduino\sketch_nov19c\sketch_nov19c.ino:6:0:
Used: C:\Users\fredr\Documents\Arduino\libraries\Adafruit_ImageReader_Library
C:\Users\fredr\Documents\Arduino\libraries\Adafruit_ImageReader_Library/Adafruit_ImageReader.h:19:10: fatal error: Adafruit_SPIFlash.h: No such file or directory
Multiple libraries were found for "SPI.h"
#include "Adafruit_SPIFlash.h"
Used: C:\Program "

Everything works perfectly without the #include "Adafruit_ImageReader.h" line.

Any solutions?

You have multiple libraries in your Arduino library folder.

Navigate to “Documents,” then go to “Arduino,” then “libraries.” Delete any duplicate libraries, or remove and reinstall all duplicated libraries.

This is the error you need to fix:

FredViken:
C:\Users\fredr\Documents\Arduino\libraries\Adafruit_ImageReader_Library/Adafruit_ImageReader.h:19:10: fatal error: Adafruit_SPIFlash.h: No such file or directory

When you see a "No such file or directory" error it almost always means you need to install the library that contains the missing file.

Often the code you're compiling will come with documentation (either a comment or separate document) that tells you where to get the library dependencies.

In other cases the author of the code will not have been so kind and you'll need to go on a hunt for the missing library.

A good place to start is the Arduino IDE's Library Manager:

  • Sketch > Include Library > Manage Libraries...
  • In the "Filter your search..." box, type some keywords you have gleaned from the missing file name.
  • Scroll through the results for the right library. Click on it.
  • Click "Install".
  • Wait for installation to finish.
  • Click "Close".
  • Try compiling your code again.

If you have no luck in Library Manager then load up your favorite search engine and do a search for the missing filename. You will often get multiple results. If you have a lot of results you might add "arduino" as an additional search keyword. I will usually prefer results on github.com since that is where most Arduino libraries are hosted and downloading from there is fast and easy. In some cases there will be multiple libraries that contain the given filename and you'll need to do some evaluation to determine which seems the most appropriate, then try it out. After downloading the library you found you'll need to install it. This requires a different process than the Library Manager installation. You will find instructions here:

FredViken:
Multiple libraries were found for "Adafruit_ImageReader.h"

In general, you can safely ignore the "Multiple libraries were found" messages. This is just some helpful information the Arduino IDE provides and doesn't necessarily indicate a problem. When multiple libraries are found that contain the file name of an #include directive, the Arduino IDE will try to pick the best one to use, and usually gets it right. The only time you need to really worry about these messages is when you can see that the Arduino IDE picked the wrong library to use. There are some cases where the "Multiple libraries were found" message is expected and doesn't indicate any problem at all. However, there is really no reason why you should have multiple copies of the Adafruit_ImageReader library installed. This tells me that you have just been flailing around and dumping copies of libraries in random locations. That is not the way to success with Arduino. Having a bunch of different copies of a library installed for no good reason may end up causing you a lot of confusion later on. Learn how to properly install libraries, install them the right way only once.

FredViken:
Multiple libraries were found for "SPI.h"

This is of even more serious concern, since the SPI library is used by a lot of different code. There is absolutely no good reason for you to have multiple versions of the SPI library installed. Please delete the extra copy of this library that you installed.

Unfortunately, this output is very difficult for a beginner to interpret due to multiple bugs in the Arduino IDE.

The first is that the first "Multiple libraries were found" message has been jumbled together with the "No such file or directory" error. It should look like this:

"Multiple libraries were found for "Adafruit_ImageReader.h"
Used: C:\Users\fredr\Documents\Arduino\libraries\Adafruit_ImageReader_Library
C:\Users\fredr\Documents\Arduino\libraries

In file included from C:\Users\fredr\Documents\Arduino\sketch_nov19c\sketch_nov19c.ino:6:0:
\Adafruit_ImageReader_Library/Adafruit_ImageReader.h:19:10: fatal error: Adafruit_SPIFlash.h: No such file or directory
#include "Adafruit_SPIFlash.h"

The second is that the "Multiple libraries were found" messages are truncated when there is a space in the path, which has been brought to the Arduino developer's attention in this bug report: