Progmem Compiler Errors 1.8.3

Greetings
I've been using the PROGMEM method for years without problem based exactly on the sample code (PROGMEM string demo) from the playground. I have just upgraded to IDE 1.8.3 and the sketch no longer compiles.

I then tried to compile the sample code from the playground and that also fails to compile with exactly the same errors. The output from the compiler is copied below.

A Google search on PROGMEM Compile errors didn't yield anything so clearly I am missing something. Any guidance would be much appreciated.

Arduino: 1.8.3 (Windows 7), Board: "Arduino/Genuino Uno"

Progmem_test:20: error: 'prog_char' does not name a type

 prog_char string_0[] PROGMEM = "String 0";   // "String 0" etc are strings to store - change to suit.

 ^

Progmem_test:21: error: 'prog_char' does not name a type

 prog_char string_1[] PROGMEM = "String 1";

 ^

Progmem_test:22: error: 'prog_char' does not name a type

 prog_char string_2[] PROGMEM = "String 2";

 ^

Progmem_test:23: error: 'prog_char' does not name a type

 prog_char string_3[] PROGMEM = "String 3";

 ^

Progmem_test:24: error: 'prog_char' does not name a type

 prog_char string_4[] PROGMEM = "String 4";

 ^

Progmem_test:25: error: 'prog_char' does not name a type

 prog_char string_5[] PROGMEM = "String 5";

 ^

Progmem_test:30: error: variable 'string_table' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

 PROGMEM const char *string_table[] =     // change "string_table" name to suit

                                  ^

Progmem_test:32: error: 'string_0' was not declared in this scope

   string_0,

   ^

Progmem_test:33: error: 'string_1' was not declared in this scope

   string_1,

   ^

Progmem_test:34: error: 'string_2' was not declared in this scope

   string_2,

   ^

Progmem_test:35: error: 'string_3' was not declared in this scope

   string_3,

   ^

Progmem_test:36: error: 'string_4' was not declared in this scope

   string_4,

   ^

Progmem_test:37: error: 'string_5' was not declared in this scope

   string_5 };

   ^

exit status 1
'prog_char' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Do you think that it would be helpful if you posted the program that is causing the errors ...

Please post a link to the playground page where you found this code. Use the chain links icon on the toolbar when you post links to make them clickable.

Thanks for swift responses. The example code giving errors from the playground is at:Arduino Playground - PROGMEM

My sketch uses this example code directly, only changing the field names.

The errors from the compiler are in my original post above

That code is:

/*
PROGMEM string demo
How to store a table of strings in program memory (flash),
and retrieve them.

Information summarized from:
http://www.nongnu.org/avr-libc/user-manual/pgmspace.html

Setting up a table (array) of strings in program memory is slightly complicated, but
here is a good template to follow.

Setting up the strings is a two-step process. First define the strings.

*/

#include <avr/pgmspace.h>
prog_char string_0[] PROGMEM = "String 0"; // "String 0" etc are strings to store - change to suit.
prog_char string_1[] PROGMEM = "String 1";
prog_char string_2[] PROGMEM = "String 2";
prog_char string_3[] PROGMEM = "String 3";
prog_char string_4[] PROGMEM = "String 4";
prog_char string_5[] PROGMEM = "String 5";

// Then set up a table to refer to your strings.

PROGMEM const char *string_table[] = // change "string_table" name to suit
{
string_0,
string_1,
string_2,
string_3,
string_4,
string_5 };

char buffer[30]; // make sure this is large enough for the largest string it must hold

void setup()
{
Serial.begin(9600);
}

void loop()
{
/* Using the string table in program memory requires the use of special functions to retrieve the data.
The strcpy_P function copies a string from program space to a string in RAM ("buffer").
Make sure your receiving string in RAM is large enough to hold whatever
you are retrieving from program space. */

for (int i = 0; i < 6; i++)
{
strcpy_P(buffer, (char*)pgm_read_word(&(string_table*))); // Necessary casts and dereferencing, just copy.*

  • Serial.println( buffer );*
  • delay( 500 );*
  • }*
    }

See the progmem reference

prog_char is outdated to my knowledge

Damn, that code is outdated... Fixed it :stuck_out_tongue:

All variables with the prog_ prefix no longer exist :slight_smile:

Many thanks for swift resolution. Very impressive. I note the playground has been updated to reflect that prog_char is outdated..

Bigworrier:
Thanks for swift responses. The example code giving errors from the playground is at:Arduino Playground - HomePage

My sketch uses this example code directly, only changing the field names.

The errors from the compiler are in my original post above

That code is:

You forgot to linkify the URL and to use code tags.

septillion:
Fixed it :stuck_out_tongue:

Thanks septillion!