linux gfx compile error glcdfont.c

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

linux gfx compile error glcdfont.c

Postby jfs10 » Wed Jan 02, 2013 7:25 pm

When trying to compile the examples for the 1.8TFT screen, I get the following error:

/usr/share/arduino/libraries/Adafruit_GFX/glcdfont.c:9:22: error: variable 'font' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

I am running Fedora 17 and arduino 1.0.1. I followed the links to download the latest libraries, still no success.

Does anyone have a solution to this problem?

Thanks
jfs10
 
Posts: 3
Joined: Wed Jan 02, 2013 6:57 pm

Re: linux gfx compile error glcdfont.c

Postby adafruit » Wed Jan 02, 2013 7:53 pm

can you try compiling the code on a windows/mac computer? it looks like the compiler is different for linux IDE?
User avatar
adafruit
 
Posts: 10483
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: linux gfx compile error glcdfont.c

Postby jfs10 » Thu Jan 03, 2013 7:19 am

Yes, it does work in Windows. I tried in version 1.0 then upgraded to version 1.0.3. Any chance of getting it to work in Linux again?

Thanks
jfs10
 
Posts: 3
Joined: Wed Jan 02, 2013 6:57 pm

Re: linux gfx compile error glcdfont.c

Postby adafruit » Thu Jan 03, 2013 11:28 am

the problem is if we fix it for linux, it breaks everything else - not sure of the solution at this time but we're aware of it and will try to find a solution
User avatar
adafruit
 
Posts: 10483
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: linux gfx compile error glcdfont.c

Postby jfs10 » Mon Jan 07, 2013 3:45 pm

Can you share the fix with me, or could you include both linux and windows files in the distribution and the linux user can rename the to a name that works and is consistent with the documentation. So, Adafruit_ST7735_linux.cpp would need to get renamed to Adafruit_ST7735.cpp for the linux user. Not ideal, but I would think doable.

Thanks
jfs10
 
Posts: 3
Joined: Wed Jan 02, 2013 6:57 pm

Re: linux gfx compile error glcdfont.c

Postby slibutti » Sun Jan 27, 2013 10:00 pm

I fixed glcdfont.c so it will compile on a linux based system running Arduino IDE by doing the following:

On line 9:

static unsigned char font[] PROGMEM = {

I added "const" to the line as follows:

const static unsigned char font[] PROGMEM = {

and now it compiles and runs.

S
slibutti
 
Posts: 4
Joined: Sat Dec 29, 2012 4:46 pm

Re: linux gfx compile error glcdfont.c

Postby jpg123 » Sat Feb 02, 2013 9:11 pm

The previous fix covered the compile prob with glcdfont.c, but it now has a host of other compile errors.
I'm also trying to get this to work on a linux IDE That is Raspberry Pi + Gertboard + Atmel 328

Is there a fix for the linux version problem yet in the pipeline ? As per the Orig post, a separate - linux - Raspberry Pi - Raspbian version fix would be good.

Many thanks
jpg123
 
Posts: 1
Joined: Sat Feb 02, 2013 8:55 pm

Re: linux gfx compile error glcdfont.c

Postby jsalassi » Mon May 13, 2013 11:08 pm

same problem here. After updating line 9 of gldfont.c to const static unsigned char font[] PROGMEM = { i get a host of the following compile errors:

/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:101:16: error: ‘prog_uchar’ does not name a type
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:159:12: error: expected unqualified-id before ‘,’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:161:11: error: expected constructor, destructor, or type conversion before ‘=’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:196:13: error: expected unqualified-id before ‘,’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:198:16: error: expected constructor, destructor, or type conversion before ‘=’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:205:24: error: expected unqualified-id before ‘,’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:206:14: error: expected constructor, destructor, or type conversion before ‘=’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:213:19: error: expected unqualified-id before ‘,’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:215:11: error: expected constructor, destructor, or type conversion before ‘=’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp: In member function ‘void Adafruit_ST7735::initB()’:
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:306:14: error: ‘Bcmd’ was not declared in this scope
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp: In member function ‘void Adafruit_ST7735::initR(uint8_t)’:
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:312:14: error: ‘Rcmd1’ was not declared in this scope
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:314:17: error: ‘Rcmd2green’ was not declared in this scope
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:319:17: error: ‘Rcmd2red’ was not declared in this scope
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:321:15: error: ‘Rcmd3’ was not declared in this scope
jsalassi
 
Posts: 5
Joined: Mon Apr 01, 2013 12:16 pm

Re: linux gfx compile error glcdfont.c

Postby jsalassi » Mon May 13, 2013 11:53 pm

OK so i'm not sure whats up with the libraries on github but here is how i resolved my problem. I credit Adafruit and the resources from the Adafruit forum for finding resolution to my problem.

1. Download libraries for my screen (sain smart 1.8" TFT LCD ST7735) from http://www.sainsmart.com/zen/documents/20-011-920/TFT18.rar

2. Unpack the content of zip file and copy into appropriately named "ST7735" libraries folder.

3. Restart Arduino IDE

3a. open up the file>examples>ST7735>graphicstest

3b. Save and give it a new name.

4. Try to compile and get error about glcdfont.c not a constant. Updated line 8 of glcdfont.c to be: const static unsigned char font[] PROGMEM = {

5. Try to compile again and get error about WProgram.h. Updated line 6 of ST7735.h to be: #include <Arduino.h>

6. Compiled this time with no issues.
jsalassi
 
Posts: 5
Joined: Mon Apr 01, 2013 12:16 pm

Re: linux gfx compile error glcdfont.c

Postby jsalassi » Wed May 15, 2013 3:03 pm

Any update on this issue?

/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:101:16: error: ‘prog_uchar’ does not name a type
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:159:12: error: expected unqualified-id before ‘,’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:161:11: error: expected constructor, destructor, or type conversion before ‘=’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:196:13: error: expected unqualified-id before ‘,’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:198:16: error: expected constructor, destructor, or type conversion before ‘=’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:205:24: error: expected unqualified-id before ‘,’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:206:14: error: expected constructor, destructor, or type conversion before ‘=’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:213:19: error: expected unqualified-id before ‘,’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:215:11: error: expected constructor, destructor, or type conversion before ‘=’ token
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp: In member function ‘void Adafruit_ST7735::initB()’:
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:306:14: error: ‘Bcmd’ was not declared in this scope
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp: In member function ‘void Adafruit_ST7735::initR(uint8_t)’:
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:312:14: error: ‘Rcmd1’ was not declared in this scope
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:314:17: error: ‘Rcmd2green’ was not declared in this scope
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:319:17: error: ‘Rcmd2red’ was not declared in this scope
/home/jsalassi/sketchbook/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:321:15: error: ‘Rcmd3’ was not declared in this scope
jsalassi
 
Posts: 5
Joined: Mon Apr 01, 2013 12:16 pm

Re: linux gfx compile error glcdfont.c

Postby szarak » Sun May 19, 2013 10:54 am

Any update on this issue?


@jsalassi
I've came across same issues, but it occured that upgrading Arduino IDE fixed the issue.

Previously I used Arduino software from Ubuntu 12.10 repo, but I've manually downloaded Arduino 64bit version from official website. The code used to produce exactly the same errors like yours, now the same code produces shiny lorem ipsum text that I'm looking at right now ;)

Let me know if it worked for you as well!
szarak
 
Posts: 1
Joined: Sun May 19, 2013 10:50 am

Re: linux gfx compile error glcdfont.c

Postby jsalassi » Sun May 19, 2013 6:29 pm

ok ill try a new version of the IDE and let you know what happens.
jsalassi
 
Posts: 5
Joined: Mon Apr 01, 2013 12:16 pm


Return to Other Arduino products from Adafruit

Who is online

Users browsing this forum: No registered users and 3 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [105]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]