最佳答案
两件事:添加一个5
和一个;
另外:确保使用-std=c++11
进行编译(对于较早的g++版本,则使用-std=c++0x
,或者对于所选编译器使用等效选项),因为类内初始化程序是C++ 11功能。
大警告:此代码为NOT supported by gcc 4.6,要求gcc> = 4.7.3
struct callbacks
{
short LastFrequency = 9000;
int *MMIO_RANGE1;
short Cycle_LN = 65535 / LastFrequency;
const char *STATUS_FLAGS[5] = // <-- 5 here
{
"ACK",
"NO_VIB",
"DATA",
"BYTEPACK",
"WORDPACK"
};
}; // <-- ; here
int main()
{
}
https://stackoverflow.com/questions/25002526/
相关文章:
c++ - 如何找到应用程序关闭时崩溃的原因?
struct - 嵌套结构初始化文字
c++ - 序列化结构的 STL 映射
C++ 套接字 : communication between PCs over internet
c++ - 尝试在 Ubuntu 11.04 上安装 Boost 1.49 时跳过 <dir> for lack of ... 错误
c++ - 从析构函数调用虚函数
c++ - 如何从模板基类派生非模板类
C++ 模板和外部函数声明
c++ - 无法在未指定捕获默认值的 lambda 中隐式捕获变量
struct - IDL : Accessing struct fields using field names stored in variables?