View Full Version : Adafruit_ST7735 + Adafruit_GFX Teensy 3

01-31-2013, 01:59 AM
Adafruit_ST7735\Adafruit_ST7735.cpp.o: In function `Adafruit_GFX':
\arduino-1.0.3-teensy3\libraries\Adafruit_GFX/Adafruit_GFX.h:28: undefined reference to `vtable for Adafruit_GFX'
collect2: ld returned 1 exit status

I have been trying to figure out the problem. From my limited experience this error usually happens when a function/method was declared as virtual and wasn't implemented. I see the new print.h is a bit different than the original. It seems the only virtual functions are the write functions, but they where also virtual in the original print.h. I tried removing the #if Arduino >= 100 in Adafruit_GFX, but that also didn't do much. I tried copying the original function/method signatures from print.h into the new one and try to figure out what changed. I just caused a big mess there.

In short, I have no clue

Easiest way to reproduce this would be to try and compile their "graphictest" example. I think the problem is in Adafruit_ST7735 maybe not implementing something, because when I don't construct Adafruit_ST7735 I don't get a compiler failure

01-31-2013, 01:37 PM
There are some errors in the Adafruit library; it seems the AVR compiler is more forgiving (or just plain wrong, really..)

See this thread for info about adding in virtual destructor and such: http://forum.pjrc.com/threads/10-Adafruit-PCD8544-LCD-library

Alternatively, you can use my adapted Teensy 3 native Library: http://forum.pjrc.com/threads/15576-Teensy3-ST7735-Library

- Peter

01-31-2013, 01:45 PM
I had a conversation with Adafruit. They're concerned any changes to GFX might break their many other libraries.

My understanding is Chris's pull request only fixes the object definition.


Is this fully compatible with the other libraries that depend upon GFX? I'm not sure what we can do, short of compiling and testing GFX in combination with many Adafruit displays on Uno, Mega and other AVR boards they sell.... to convince them to merge this fix?

01-31-2013, 02:09 PM
I think his pull request is sufficient to make it compile and work? I'm not sure, but it addresses the virtual destructor and missing pure virtual on DrawPixel.

On a separate note, I wouldn't mind making my native version compatible with their GFX stuff, and even put the changes into their ST7735 lib, but due to the fact they don't make some functions virtual that I want to override, it can't really be done - and it doesn't sound like they are keen to change it.

I don't think software is really one of their strengths, the code is pretty weird, as if written by a non-programmer, or at least someone who doesn't quite understand C++.

- Peter