Error using Adafruit_SSD1306.h

Hi all.

Got a clash of libraries here...

#include <SPI.h>
#include <ILI9341_t3.h>
#include <TouchScreen.h>
#include <Wire.h>
#include <EEPROM.h>
#include <Adafruit_SSD1306.h>

I get the error:

Adafruit_GFX_Library/Adafruit_GFX.h:242:7: error: redefinition of 'class Adafruit_GFX_Button'
class Adafruit_GFX_Button {

I think it must already be declared in the ILI9341_t3.h library.
I don't want to edit the library (unless I REALLY have to). Any way to bypass/ignore this error?

I will go and see if I can find the repeated request (assuming that is what it is)

Found this in ILI9341_t3.h

// To avoid conflict when also using Adafruit_GFX or any Adafruit library
// which depends on Adafruit_GFX, #include the Adafruit library BEFORE
// you #include ILI9341_t3.h.

Hasn't fixed the issue however

Yeah... the ILI9341_t3 library is the issue here. It includes its own copy of the Adafruit_GFX_Button class. #include-ing Adafruit_GFX in your sketch before #including ILI9341_t3 fixes the problem in your sketch, but when the ILI9341_t3 library is built, it still includes the extra copy of the class (because compiling the library is separate from compiling the sketch, so the library compile has no idea what went on in the sketch compile). So it just moves the problem from the compile stage to the link stage, where you end up with two classes named the same.

I think the quickest way to make it go away will require editing the ILI9341_t3 source. I think renaming its copy of the Adafruit_GFX_Button class to ILI9341_t3_Button will do the trick.

Oh no... me editing libraries.... that can't end well
Thanks

I will have to rename it in multiple places I assume (why call it the same name .... gee thanks)

It doesn't look all that bad. I've not kept up to date on the Teensy core (TL;DR - what I've got works and I'm not risking breaking it by updating!) but in my version at least, you only have to edit ILI9341_t3.h and ILI9341_t3.cpp and change the class name in a grand total of 5 places.

van_der_decken you are a legend.

That fixed the problem. Thank you

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.