我使用AVR-GCC 4.7.0版和字符串数组,当我试图创建FLASH存储器字符串数组我得到的错误:存储在闪存与PROGMEM在Arduino的
variable ‘menu’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’
我使用此代码:
const char menu0[] PROGMEM = "choice0";
const char menu1[] PROGMEM = "choice1";
const char menu2[] PROGMEM = "choice2";
const char menu3[] PROGMEM = "choice3";
const char menu4[] PROGMEM = "choice4";
const char menu5[] PROGMEM = "choice5";
const char *menu[] PROGMEM = {menu0, menu1, menu2, menu3, menu4, menu5};
我已经看过堆栈溢出问题C - how to use PROGMEM to store and read char array,但我看到的答案不包括const
关键字这使我相信这是需要之前,他们写的。
如何解决这个问题?
const char * const menu[] PROGMEM = {menu0, menu1, menu2, menu3, menu4, menu5};
他回答。
试试这个:'const char * const menu [] ...' – imreal