Compiler error after IDE update

I use Visual Micro for a project that had worked and compiled fine before. But now I get compiler error in a file called DateStrings.cpp . I get this rsult from compiling

Compiling ‘TestPrecRTCClock’ for ‘Arduino Mega w/ ATmega2560 (Mega 2560)’
DateStrings.cpp:42:22: error: variable ‘monthNames_P’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’
DateStrings.cpp:59:20: error: variable ‘dayNames_P’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’
Error compiling

In the Visual Micro forum I was answered this,

'I think you have upgraded your arduino ide which uses new tool chains.
The new tool chains requires read-only variables to be declared “const”
You should see the same error if you compile with the Arduino Ide. ’

This does not make sense for me since the variables in question are declared as constants in

#if defined(__AVR__)
#include <avr/pgmspace.h>
#else
// for compatiblity with Arduino Due and Teensy 3.0 and maybe others?
#define PROGMEM
#define PGM_P  const char *
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#define pgm_read_word(addr) (*(const unsigned char **)(addr))
#define strcpy_P(dest, src) strcpy((dest), (src))
#endif

After pointing out this I’m advised to go here for help with the arduino cores

This does not make sense for me since the variables in question are declared as constants in

Well, it should, since those are functions, not variables.

variable ‘monthNames_P’ must be const

THAT is a variable.

DateStrings.cpp:42:22

Defined on line 42 of that file, in column 22.

The particular message you are seeing HAS been documented, more than once, as has the solution. You seem to be incapable of using the search function. Why?

I make a update from 1.0.6 to 1.6.13. After this a got problems compiling my old sketches. Library errors. What went wrong?

There have been numerous compiler and tool updates between older and newer IDE versions. Most of the progmem declarations originally used in Arduino code (Arduino supplied core & library code as well as 3rd party libraries and sketches) were actually wrong. The incorrect declarations happened to still work with the older compiler tools but it no longer works with the newer tools. When the correct progmem declarations are done, it works on both the old as well as the newer tools.

You can either fix it yourself, by correcting the progmem declarations, or look for newer versions of the libraries.

I would suggest that you look for newer versions of the libraries as there have been some other updates to the Arduino core libraries that can also cause issues. In the case of some of certain LCD libraries, the code still compiles but doesn't work correctly.

The good thing is you can use the IDE library manager to update the libraries so it is easier and much quicker to get things updated than it was way back then in the 1.0 days.

--- bill