Compile Error collect2: error: ld returned 1 exit status

Hi i am getting a compile Error

The error Log:

32+0 records in
32+0 records out
32 bytes (32 B) copied, 0.000109436 s, 292 kB/s
4+0 records in
4+0 records out
4 bytes (4 B) copied, 0.0488805 s, 0.1 kB/s
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-led-backpack/adafruit-gfx.cpp:39: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-led-backpack/adafruit-gfx.h:5,
                 from adafruit-led-backpack/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-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::drawLine(short, short, short, short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::drawRect(short, short, short, short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::drawFastVLine(short, short, short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::drawFastHLine(short, short, short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::fillRect(short, short, short, short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::fillScreen(unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::invertDisplay(bool)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `vtable for Adafruit_GFX'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::Adafruit_GFX(short, short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::Adafruit_GFX(short, short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::drawCircle(short, short, short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::drawCircleHelper(short, short, short, unsigned char, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::fillCircleHelper(short, short, short, unsigned char, short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::fillCircle(short, short, short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::drawRoundRect(short, short, short, short, short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::fillRoundRect(short, short, short, short, short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::drawTriangle(short, short, short, short, short, short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::fillTriangle(short, short, short, short, short, short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::drawBitmap(short, short, unsigned char const*, short, short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::drawChar(short, short, unsigned char, unsigned short, unsigned short, unsigned char)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::write(unsigned char)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::setCursor(short, short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::setTextSize(unsigned char)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::setTextColor(unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::setTextColor(unsigned short, unsigned short)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::setTextWrap(bool)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
adafruit-gfx.o (symbol from plugin): In function `Adafruit_GFX::height() const':
(.text+0x0): multiple definition of `Adafruit_GFX::setRotation(unsigned char)'
Adafruit_GFX.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [3214fdde67ee819434056a75898b25e22b3d6eca4f96b1e9ce602b69c04c.elf] Error 1
make: *** [main] Error 2

any ideas what I can do to solve this?

Multiple definitions of the same functions usually come from libraries that bring their own copies of them - try to eliminate the doubles.

You’ve got adafruit-gfx and Adafruit_GFX

2 Likes