Arduino错误:* token之前预期的初始化器
arduino error: expected initializer before * token
#include <WProgram.h>
#include <EEPROM.h>
template <class T> int EEPROM_writeAnything(int ee, const T& value)
{
const byte* p = (const byte*)(const void*)&value;
int i;
for (i = 0; i < sizeof(value); i++)
EEPROM.write(ee++, *p++);
return i;
}
template <class T> int EEPROM_readAnything(int ee, T& value)
{
byte* p = (byte*)(void*)&value;
int i;
for (i = 0; i < sizeof(value); i++)
*p++ = EEPROM.read(ee++);
return i;
}
嗨社区,我的代码出现了以下错误:
EEPROMAnything.h: In function 'int EEPROM_writeAnything(int, const T&)':
EEPROMAnything.h:6:错误:'*' token之前的期望初始化器
EEPROMAnything.h:9: error: 'p'未在此作用域中声明
EEPROMAnything.h: In function 'int EEPROM_readAnything(int, T&)':
EEPROMAnything.h:15: error: 'byte'未在此作用域中声明
EEPROMAnything.h:15: error: 'p'未在此作用域中声明
EEPROMAnything.h:15:错误:')'标记前的期望主表达式
EEPROMAnything.h:15:错误:'void'之前预期的主表达式
不知道我在这个集合中错过了什么。希望得到反馈!
由于
找出不工作的地方
#include <WProgram.h>
应改为
#include <Arduino.h>
感谢大家的评论!
相关文章:
- 使用默认构造函数引用成员变量初始化错误
- 交换机案例语句中的初始化错误
- 英特尔 MKL 稀疏 QR 求解 C++ 返回未初始化错误
- 在模板类中使用"this"会导致参数初始化错误
- 映射的映射集的映射初始化错误
- C++图形初始化错误(语法或丢失文件缺陷?
- QSQLDATABASE:SIGSEV初始化错误
- 映射的 std::for_each() 给出无效的初始化错误
- 初始化错误过多
- C++初始化错误 std::set
- 简单的类构造函数初始化错误
- 组合框初始化错误:无法读取未定义的属性'constructor'
- OpenCV卡尔曼滤波器初始化错误
- C++11动态数组部分列表初始化(错误或误解)
- C++ 静态变量在发布模式下初始化错误
- Visual Studio 2010 SP1 中的 64 位整数初始化错误
- C++libPNG-简单初始化错误
- 结构数组-初始化错误
- 初始化错误
- 我不断收到函数初始化错误.(运行时检查失败 #3)