G++ (FreeBSD) 错误: '{'令牌之前预期的主表达式
g++ (freebsd) error: expected primary-expression before '{' token
我有一些代码在使用g++的ubuntu中运行良好但未能在freebsd中编译,我不知道为什么
//in the source body MyClass.cpp
void MyClass::app_init()
{
funcs[0] = { &MyClass::app_map, 4 };
funcs[1] = { &MyClass::app_pro, 10 };
}
//in the header MyClass.h
public:
struct foo
{
int fd;
time_t ts;
};
struct func
{
void (MyClass::*f) (foo *);
int arg_length;
};
void app_init();
void app_map(foo *a);
void app_pro(foo *a);
private:
func funcs[FUNCS_ARRAY]; //2
funcs[0] = (func){ &MyClass::app_map, 4 };
...
或使用g++ --std=c++11 ...
编译
相关文章:
- holeMenuProgram.cpp:38:1 错误:'}'令牌之前的预期主表达式
- (错误:令牌之前'<<'预期的主表达式)
- 错误:C++中']'令牌之前的预期主表达式
- 错误:令牌之前的预期主表达式'&&'
- 令牌之前']'预期的主表达式?
- 错误:令牌之前的预期主表达式'/'
- 正则表达式使用提升令牌迭代器在单引号和括号之间提取值
- 令牌之前')'预期的主表达式(需要"template"消除歧义器)
- 错误:令牌之前的预期主表达式'<':Arduino RGB 舞灯
- 令牌之前出现错误')'主表达式
- C++错误:错误:令牌之前的预期主表达式'||'
- 令牌问题之前'*'预期的主表达式
- 令牌之前的预期表达式']'?C
- 退出状态 1 令牌之前的预期主表达式'.'
- C++错误:";"之前应为主表达式使用Cmake的令牌
- 向量空Push_back在令牌之前调用'{'预期的主表达式
- 令牌调用之前'...'预期的主表达式 模板化类的模板化方法
- 错误 预期主表达式在 ';" 之前令牌 C++
- 令牌之前的预期主表达式'-'
- 令牌之前的预期主表达式'<'