Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

128x32 i2c OLED -- compile problem
Moderators: adafruit_support_bill, adafruit

128x32 i2c OLED -- compile problem

by joss on Tue Nov 20, 2012 10:19 pm

I just purchased a 128x32 i2c OLED from adafruit and am following the instructions at
http://learn.adafruit.com/monochrome-ol ... 2c-display
but I am getting a compile error about conflicting declarations:

.../Arduino/libraries/Adafruit_SSD1306/Adafruit_SSD1306.cpp:31: error: conflicting declaration 'uint8_t font []'
.../Arduino/libraries/Adafruit_GFX/glcdfont.c:9: error: 'font' has a previous declaration as 'const unsigned char font [1275]'

I am new to arduino and am hoping somebody has a good idea.

Thanks in advance
joss
 
Posts: 3
Joined: Tue Nov 20, 2012 10:06 pm

Re: 128x32 i2c OLED -- compile problem

by nikk on Wed Nov 21, 2012 8:59 am

Hi,
i just got mine today. I had the same error.

Just comment out line 31 in Adafruit_SSD1306.cpp. The demo is working for me after that.
I don´t understand why there is this line 31 in Adafruit_SSD1306.cpp.


Regards,
nikk
nikk
 
Posts: 1
Joined: Wed Nov 21, 2012 8:53 am

Re: 128x32 i2c OLED -- compile problem

by adafruit on Wed Nov 21, 2012 11:43 am

which version of the IDE are you using?

adafruit
 
Posts: 11905
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: 128x32 i2c OLED -- compile problem

by Constantin on Wed Nov 21, 2012 6:09 pm

I am using 1.01 and I have the same issue. Both sets of files just downloaded from github.
Constantin
 
Posts: 6
Joined: Sat Aug 09, 2008 8:24 am
Location: Peoples Republic of Cantabridgia

Re: 128x32 i2c OLED -- compile problem

by joss on Wed Nov 21, 2012 6:23 pm

I was running version 1.0.1 of the IDE. I upgraded to 1.0.2 and got the same result.

I tried nikk's fix above and that worked.

to be clear I commented out line 31 in Adafruit_SSD1306.cpp
giving the following:

// a 5x7 font table
//extern uint8_t PROGMEM font[];

then it compiles and runs fine.

I am unclear if this change will have unfortunate consequences later.

Thanks
joss
 
Posts: 3
Joined: Tue Nov 20, 2012 10:06 pm

Re: 128x32 i2c OLED -- compile problem

by adafruit on Wed Nov 21, 2012 7:40 pm

thats odd - what OS are you using?

adafruit
 
Posts: 11905
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: 128x32 i2c OLED -- compile problem

by joss on Wed Nov 21, 2012 8:31 pm

I am on Mac OS X 10.7.2, but I think the problem will prove to be platform agnostic.

Line 31 from Adafruit_SSD1306.cpp:

extern uint8_t PROGMEM font[];

Line 9 from Adafruit_GFX.cpp:

const static unsigned char font[] PROGMEM = {

since we are clearly defining font[] twice and with different types.

I just downloaded both libraries from github on the 20th.
joss
 
Posts: 3
Joined: Tue Nov 20, 2012 10:06 pm

Re: 128x32 i2c OLED -- compile problem

by Constantin on Sat Nov 24, 2012 4:05 pm

I have the same issue in OSX 10.7.5 and Windows 7. Both running 1.01 of the Arduino IDE.
Constantin
 
Posts: 6
Joined: Sat Aug 09, 2008 8:24 am
Location: Peoples Republic of Cantabridgia

Re: 128x32 i2c OLED -- compile problem

by jarruda on Sun Nov 25, 2012 12:42 am

I believe the correct solution to the problem is this:

Line 31 of Adafruit_SSD1306:
Code: Select all | TOGGLE FULL SIZE
From:
  extern uint8_t PROGMEM font[];
To:
  extern const uint8_t PROGMEM font[];


and

Line 9 of glcdfont.c:
Code: Select all | TOGGLE FULL SIZE
From:
  const static unsigned char  font[] PROGMEM = {
To:
  const static uint8_t  font[] PROGMEM = {


Note that changing glcdfont.c isn't strictly necessary since a uint8_t is just an unsigned char, but Dennis Ritchie would haunt me.

After making the change, I ran the 128x32 SPI example sketch from the library and it's working just fine.
jarruda
 
Posts: 25
Joined: Sun Jan 29, 2012 12:40 pm

Re: 128x32 i2c OLED -- compile problem

by adafruit on Sun Nov 25, 2012 1:34 pm

sorry, someone sent us a pull request that just broke everything and we blindly assumed it was fixing a bug. GFX has been reverted, you can redownload it!

adafruit
 
Posts: 11905
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc