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