.h-file with PROGMEM wont compile in PlatformIO

I have a problem compiling an Arduino project with some .h-files in Platform IO.
The project is “ThingPulse Weather Station in Color” that i am running on a ESP8266 (Wemos D1 Mini).
It compiles and runs fine in Arduino IDE, but wont compile in Platform IO.
The compilation stops at .h files that contains the word PROGMEM.

A typical content of a .h file problem is as follows:

const char ThingPulseLogo[ ] PROGMEM = {
** 0x01, // Version: 1**
** 0x02, // BitDepth: 2**
** 0x00, 0xC8, // Width: 200**
** 0x00, 0x50, // Height: 80**
** // Round width to next byte: 200**
** 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,**
** …etc…**
** 0xAA, 0x80, 0x02, 0xAA, 0xAA, 0xAA, 0xAA, **
** };**

In Arduino IDE the project (including .h files), compiles & runs just fine,
but in PlatformIO the compiler stops, highlights all the words PROGMEM in the .h-files, and gives error message :
expected a ‘;’ C/C++(65) [1,29]

Please let me know if there is any more info I can provide, and how can I troubleshoot & correct this ??

Have you used #include <pgmspace.h>? I think you need that header file to use PROGMEM.


Isn’t the PlatformIO forum great or what !!

I posted my problem here, went for a short walk with the dog, and when I came back NormanDunbar had posted the solution to my problem !!

Now it compiles just fine in PlatformIO without PROGMEM errors !!

Thank you, and thank you again for saving me many hours of troubleshooting !!!

1 Like

We try to help. :wink: In my case I get PlatformIO for free, so if I can give back in some way, then I do.

The Arduino IDE and language together, do a hell of a lot of “stuff” in the background and under the covers to make life easy. Including the assorted header files that you miss out is one of them.