I am trying to run the test program from Adafruit, with their libraries, for an Arduino controlling a Nokia5110 display and get this error message:

Arduino: 1.5.8 (Linux), Board: "Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)"

    /home/Harry/Arduino/libraries/Adafruit_GFX/glcdfont.c:9:23: error: variable 'font' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
     static unsigned char  font[] PROGMEM = {
    Error compiling.

Please can anyone explain this? I can happily give more details, but I am not yet sure how much is needed and the files are rather too long to include them all at this stage.

  • Include you FULL code.
    – Dat Ha
    Commented Dec 22, 2016 at 18:08
  • 1
    Looks like this was already fixed. Are you using an old GFX library?
    – gre_gor
    Commented Dec 22, 2016 at 18:15
  • The error already says what you should do, and even points to were you need to add it.
    – Gerben
    Commented Dec 22, 2016 at 19:48

2 Answers 2


The problem is you're using an old version of the Adafruit GFX Library, which was written for a previous version of the Arduino IDE. You just need to install the latest version of the library and your problem will be solved:

  1. Download https://github.com/adafruit/Adafruit-GFX-Library/archive/master.zip
  2. Unzip the downloaded file.
  3. Rename the unzipped folder Adafruit_GFX
  4. Replace /home/Harry/Arduino/libraries/Adafruit_GFX with the folder.

If you run into any other problems after doing that I recommend trying the latest version of the Arduino IDE. The version you're using is very outdated.


You can not change variables in PROGMEM memory.
Therefore the variable must be a const variable.
This way the compiler can check whether you try to change the value or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.