Adafruit_GFX/Adafruit_GFX.h: No such file or directory

i just have a OLED to display some messages, I used the these two libraries
ADAFRUIT_SSD1306265
ADAFRUIT_SSD133113
however, both examples can’t be compiled due to a problem saying: adafruit_gfx.cpp:34:39: fatal error: Adafruit_GFX/Adafruit_GFX.h: No such file or directory

Are you using the Web IDE or the DEV IDE?

Web IDE

Have you added them through the library system, or simply copy & pasted code? You need to do the former for them to be added.

You need to find the library in the listing in the iDE, and select “include in App” and select the app to include it into. If the include in yuor app doesn’t say something like “Library automatically added” then you are doing it wrong.

I just go to the library page, there are three options on the left pan, ‘fork this library’, ‘use this example’, ‘include in app’, i choose to use the example. however it doesn’t work.

Try including that specific library manually to that example.

i even tried this , #include “ADAFRUIT_SSD1306/Adafruit_GFX.h”, still doesn’t work

You have to match the case of the path
#include "Adafruit_SSD1306/Adafruit_GFX.h"

e.g. surfsoon-oled.ino builds by altering the includes into this

#include "Adafruit_SSD1306/Adafruit_SSD1306.h"
#include "Adafruit_SSD1306/Adafruit_GFX.h"
...

now there is no error saying that, but get another error:

adafruit_gfx.cpp:36:0: warning: "pgm_read_byte" redefined [enabled by default]

In file included from ../wiring/inc/spark_wiring.h:37:0,
from ./inc/application.h:36,
from adafruit_gfx.cpp:33:
../wiring/inc/spark_wiring_arduino.h:32:0: note: this is the location of the previous definition
#define pgm_read_byte(x) ((x))
^
Adafruit_SSD1306/Adafruit_GFX.cpp:36:0: warning: "pgm_read_byte" redefined [enabled by default]
#define pgm_read_byte(addr) (
(const unsigned char )(addr))
^
In file included from ../wiring/inc/spark_wiring.h:37:0,
from ./inc/application.h:36,
from Adafruit_SSD1306/Adafruit_GFX.h:4,
from Adafruit_SSD1306/Adafruit_GFX.cpp:34:
../wiring/inc/spark_wiring_arduino.h:32:0: note: this is the location of the previous definition
#define pgm_read_byte(x) (
(x))
^
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::invertDisplay(bool)': Adafruit_SSD1306/Adafruit_GFX.cpp:420: multiple definition of Adafruit_GFX::drawLine(short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:420: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::drawRoundRect(short, short, short, short, short, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:462: multiple definition of Adafruit_GFX::drawRect(short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:462: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::drawFastVLine(short, short, short, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:470: multiple definition of Adafruit_GFX::drawFastVLine(short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:470: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::drawFastHLine(short, short, short, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:476: multiple definition of Adafruit_GFX::drawFastHLine(short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:476: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::fillRect(short, short, short, short, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:482: multiple definition of Adafruit_GFX::fillRect(short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:482: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::fillScreen(unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:489: multiple definition of Adafruit_GFX::fillScreen(unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:489: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::invertDisplay(bool)': Adafruit_SSD1306/Adafruit_GFX.cpp:727: multiple definition of Adafruit_GFX::invertDisplay(bool)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:727: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::Adafruit_GFX(short, short)': Adafruit_SSD1306/Adafruit_GFX.cpp:297: multiple definition of Adafruit_GFX::Adafruit_GFX(short, short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:297: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::Adafruit_GFX(short, short)': Adafruit_SSD1306/Adafruit_GFX.cpp:297: multiple definition of Adafruit_GFX::Adafruit_GFX(short, short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:297: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::drawCircle(short, short, short, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:311: multiple definition of Adafruit_GFX::drawCircle(short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:311: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::drawCircleHelper(short, short, short, unsigned char, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:345: multiple definition of Adafruit_GFX::drawCircleHelper(short, short, short, unsigned char, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:345: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::fillCircleHelper(short, short, short, unsigned char, short, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:388: multiple definition of Adafruit_GFX::fillCircleHelper(short, short, short, unsigned char, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:388: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::fillCircle(short, short, short, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:381: multiple definition of Adafruit_GFX::fillCircle(short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:381: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::drawRoundRect(short, short, short, short, short, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:495: multiple definition of Adafruit_GFX::drawRoundRect(short, short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:495: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::fillRoundRect(short, short, short, short, short, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:510: multiple definition of Adafruit_GFX::fillRoundRect(short, short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:510: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::drawTriangle(short, short, short, short, short, short, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:522: multiple definition of Adafruit_GFX::drawTriangle(short, short, short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:522: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::fillTriangle(short, short, short, short, short, short, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:531: multiple definition of Adafruit_GFX::fillTriangle(short, short, short, short, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:531: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::drawBitmap(short, short, unsigned char const*, short, short, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:608: multiple definition of Adafruit_GFX::drawBitmap(short, short, unsigned char const*, short, short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:608: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::drawChar(short, short, unsigned char, unsigned short, unsigned short, unsigned char)': Adafruit_SSD1306/Adafruit_GFX.cpp:641: multiple definition of Adafruit_GFX::drawChar(short, short, unsigned char, unsigned short, unsigned short, unsigned char)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:641: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::write(unsigned char)': Adafruit_SSD1306/Adafruit_GFX.cpp:621: multiple definition of Adafruit_GFX::write(unsigned char)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:621: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::setCursor(short, short)': Adafruit_SSD1306/Adafruit_GFX.cpp:675: multiple definition of Adafruit_GFX::setCursor(short, short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:675: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::setTextSize(unsigned char)': Adafruit_SSD1306/Adafruit_GFX.cpp:680: multiple definition of Adafruit_GFX::setTextSize(unsigned char)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:680: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::setTextColor(unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:686: multiple definition of Adafruit_GFX::setTextColor(unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:686: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::setTextColor(unsigned short, unsigned short)': Adafruit_SSD1306/Adafruit_GFX.cpp:690: multiple definition of Adafruit_GFX::setTextColor(unsigned short, unsigned short)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:690: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::setTextWrap(bool)': Adafruit_SSD1306/Adafruit_GFX.cpp:695: multiple definition of Adafruit_GFX::setTextWrap(bool)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:695: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::getRotation()': Adafruit_SSD1306/Adafruit_GFX.cpp:700: multiple definition of Adafruit_GFX::getRotation()'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:700: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::setRotation(unsigned char)': Adafruit_SSD1306/Adafruit_GFX.cpp:703: multiple definition of Adafruit_GFX::setRotation(unsigned char)'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:703: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::width()': Adafruit_SSD1306/Adafruit_GFX.cpp:721: multiple definition of Adafruit_GFX::width()'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:721: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::height()': Adafruit_SSD1306/Adafruit_GFX.cpp:725: multiple definition of Adafruit_GFX::height()'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:725: first defined here
../../../build/target/user/platform-6/libuser.a(Adafruit_GFX.o):(.rodata._ZTV12Adafruit_GFX+0x0): multiple definition of `vtable for Adafruit_GFX'
../../../build/target/user/platform-6/libuser.a(adafruit_gfx.o):(.rodata._ZTV12Adafruit_GFX+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [33c0a088f86f61a7604b7284eded60a8a16bcabaf826623989f8f4357865.elf] Error 1

Before going into any details of your error report:
Since the library brings its own Adafruit_GFX make sure that you haven’t imported the lib a second time.
If you have, just drop it by use of the (X) icon next to the library name.

Maybe you could provide a screenshot of the sidebar, the first include lines of your sketch and the file tabs of the IDE.

i am sure there is only one imported library.

No screenshot?

The code alone won’t tell you what’s actually imported, the IDE has its own display on the side. A screenshot like this should tell us more:

The only thing I changed the example is to replace "#include “Adafruit_GFX.h” with "#include “ADAFRUIT_SSD1306/Adafruit_GFX.h”

Your INO file is the double declaration itself.

Try one of the SSD demos (denoted by the extension INO) instead.

As I said: The SSD lib brings its own Adafruit_GFX so don’t redeclare it - neither by import nor by copy-paste.

Adafruit_GFX.cpp is not an example, so you shall not press USE THIS EXAMPLE for it.

i had the same error but i updated the library and chose tho include the relevant files to download instead of just the ADAFRUIT_SSD1306265 libraries