Can't get SSD1306 example to compile [SOLVED]

I start with a Google search and find this post on how to use an example from the Wed IDE Library
Use This Example


First off I notice that this library has red boxes for all Particle platforms. However, I see this post that says this issue has been solved. Adafruit SSD1306 [SOLVED]

Next I click on the “Use this Example” button.

On attempting to compile this application. I get an error stating that the comiler can’t find the GFX library. So after 5 button clicks I got the Adafruit_GFX library added to the app.

Compiling this app now, yields this error message

adafruit_gfx.cpp:37:26: fatal error: Adafruit_GFX.h: No such file or directory
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
^

compilation terminated.
make1: *** […/build/target/user/platform-6adafruit_gfx.o] Error 1
make: *** [user] Error 2

So it looks like adding the GFX library manually added an extra include statement. (So maybe I’m doing this “Use Example” bit) wrong. So I remove the original include statement. Compiling the application this time yielded a bunch of compiler errors

adafruit_gfx.cpp:37:0: warning: “pgm_read_byte” redefined [enabled by default]
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
^
In file included from …/wiring/inc/spark_wiring.h:37:0,
from ./inc/application.h:36,
from adafruit_gfx.cpp:2:
…/wiring/inc/spark_wiring_arduino.h:32:0: note: this is the location of the previous definition
#define pgm_read_byte(x) ((x))
^
Adafruit_GFX/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_GFX/Adafruit_GFX.h:4,
from Adafruit_GFX/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))
^
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_GFX/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:421: 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_GFX/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:463: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::drawFastVLine(short, short, short, unsigned short)': Adafruit_GFX/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:471: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::drawFastHLine(short, short, short, unsigned short)': Adafruit_GFX/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:477: 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_GFX/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:483: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::fillScreen(unsigned short)': Adafruit_GFX/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:490: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::invertDisplay(bool)': Adafruit_GFX/Adafruit_GFX.cpp:727: multiple definition of Adafruit_GFX::invertDisplay(bool)’
…/…/…/build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:728: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::Adafruit_GFX(short, short)': Adafruit_GFX/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:298: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::Adafruit_GFX(short, short)': Adafruit_GFX/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:298: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::drawCircle(short, short, short, unsigned short)': Adafruit_GFX/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:312: 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_GFX/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:346: 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_GFX/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:389: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::fillCircle(short, short, short, unsigned short)': Adafruit_GFX/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:382: 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_GFX/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:496: 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_GFX/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:511: 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_GFX/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:523: 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_GFX/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:532: 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_GFX/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:609: 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_GFX/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:642: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::write(unsigned char)': Adafruit_GFX/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:622: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::setCursor(short, short)': Adafruit_GFX/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:676: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::setTextSize(unsigned char)': Adafruit_GFX/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:681: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::setTextColor(unsigned short)': Adafruit_GFX/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:687: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::setTextColor(unsigned short, unsigned short)': Adafruit_GFX/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:691: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::setTextWrap(bool)': Adafruit_GFX/Adafruit_GFX.cpp:695: multiple definition of Adafruit_GFX::setTextWrap(bool)’
…/…/…/build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:696: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::getRotation()': Adafruit_GFX/Adafruit_GFX.cpp:700: multiple definition of Adafruit_GFX::getRotation()’
…/…/…/build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:701: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::setRotation(unsigned char)': Adafruit_GFX/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:704: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::width()': Adafruit_GFX/Adafruit_GFX.cpp:721: multiple definition of Adafruit_GFX::width()’
…/…/…/build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:722: first defined here
…/…/…/build/target/user/platform-6/libuser.a(Adafruit_GFX.o): In function Adafruit_GFX::height()': Adafruit_GFX/Adafruit_GFX.cpp:725: multiple definition of Adafruit_GFX::height()’
…/…/…/build/target/user/platform-6/libuser.a(adafruit_gfx.o):adafruit_gfx.cpp:726: 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 ../../../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:421: 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:463: 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:471: 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:477: 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:483: 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:490: 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:728: 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:298: 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:298: 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:312: 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:346: 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:389: 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:382: 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:496: 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:511: 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:523: 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:532: 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:609: 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:642: 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:622: 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:676: 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:681: 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:687: 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:691: 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:696: 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:701: 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:704: 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:722: 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:726: 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: *** [e0423145c1636a77b485fc7ae5fde698927e91d2a839d75219019b46cc71.elf] Error 1

I continued past this stage trying all sorts of things but with no luck.

I must be doing something wrong. However, I do feel the “Use this Example” should be a better experience. Also if the example I selected does in fact NOT work on any of the particle platforms. Why is it in the library?

Anyway, I’d appreciate any help on getting the SSD1306 OLED working on the Photon.

Thank you.

These indicators are missleading since the samples are automatically tested which doesn’t yet support dependencies with other required libraries (e.g. Adafruit_GFX).
So the indicators are right and wrong.
The samples don’t build without the 3rd party libs but would when used right.

Your bunch of link errors suggests that there are multiple copies of the Adafruit_GFX lib in your project.
That happens when a lib brings its own copy of a 3rd party lib (=bad habit).
So just remove the Adafruit_GFX library again.
Then follow the steps here (that’s from the thread you linked)


And try again - please post the resulting error messages (if any).

I’ll have a look at that sample soon and come back to you.

Hey @ScruffR, thank you for your quick response to my post. Folks can almost always count on your prompt help!.

Since my post I “manually” created an app by added new files and copy pasting code from the Adafruit_SSD1306.h/.cpp and Adafruit_GFX.h/.cpp library files into these files in my project/app.

My .ino file was almost exactly the same as the Arduino code from Adafruit’s example program for the I2C version. The only change I made to this file was the binary numbers, where I prefixed with zeros as follows:

static const unsigned char PROGMEM logo16_glcd_bmp[] =
{ 0B00000000, 0B11000000,
  0B00000001, 0B11000000,
  0B00000001, 0B11000000,
  0B00000011, 0B11100000,
  0B11110011, 0B11100000,
  0B11111110, 0B11111000,
  0B01111110, 0B11111111,
  0B00110011, 0B10011111,
  0B00011111, 0B11111100,
  0B00001101, 0B01110000,
  0B00011011, 0B10100000,
  0B00111111, 0B11100000,
  0B00111111, 0B11110000,
  0B01111100, 0B11110000,
  0B01110000, 0B01110000,
  0B00000000, 0B00110000 };

The code compiled and the app works!

The Pin connections between the 128x64 0.96" display and the Photon are as follows

/*********************************************************************
Wiring Instructions
SDA pin of Display goes to D0 pin on Photon
SCL pin of Display goes to D1 pin on Photon
GND Pin of Display goes to Gnd pin on Photon
VCC Pin of Display goes to 3v3 pin on Photon
**********************************************************************/ 

The I2C address on my Display is 0x3C so display.begin() line in the setup method looks like this:

// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3D (for the 128x64)
  // init done

Thank you once again.

2 Likes

Here is a Photo of the Photon and Display

Here is a snapshot of the Project in the Wed IDE

And if you did use the USE THIS EXAMPLE you’d need to alter the includes like this

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

and probably remove/comment this function from the sample (if it’s present)

int random(int maxRand) {
    return rand() % maxRand;
}
1 Like

I actually did that (having seen your posts in other threads). Which is how I got past the fact that the compiler couldn’t find the included files, to the bunch of compiler issues I listed in the very first post.

Oh, I think I now understand why you posted this…

Since I added files manually (by adding blank files) and then pasting in the code, these files were (I’m guessing) added in the same “folder” as my .ino file. So I don’t need to include the paths to the header files in my include statement.

1 Like