Possible Duplicate:
“expected ':', ',', ';', '}' or 'attribute' before '{' token” in Struct member function如何用Android NDK编译结构与成员函数?
我使用android ndk-build编译C++库。当代码中有一个定义了成员函数的结构时,我得到编译错误。 此代码与其他编译器一起编译。
示例代码:
typedef struct
{
boolean current;
int a;
boolean IsCurrent() const
{
return current;
}
} sampleStruct;
我得到的错误是 - “错误:预期 ':', ' ' '', '}' 或' 属性' 前 '常量' “ 如果我摆脱常量的,错误是 - ” 错误:预期 ':', ' ' '', '}' 或' 属性' 前 '{' 令牌”
您正在使用哪种C++编译器? – 2012-04-17 08:15:42
布尔应该可能是布尔! – Stowelly 2012-04-17 09:32:53