您的位置:首页 > 其它

gcc 编译错误 error:expected class-name before ';' token

2010-10-12 00:09 781 查看
下面一段程序在使用gcc test.cpp -o test进行编译的时候无法编译通过,报错

error:expected class-name before ';' token

而将int compl改为 int xx就正常。

//test.cpp

typedef struct

{

  int compl;

  int somebody;

} TestSt;

int main()

{

TestSt test;

return 0;

}

查看gcc手册发现这个符号为keyword:

-fno-operator-names
           Do not treat the operator name keywords "and", "bitand", "bitor", "compl", "not", "or" and "xor"
           as synonyms as keywords.

使用下面方法编译就正常:

gcc [b][b]-fno-operator-names 

[/b][/b]test.cpp -o test
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: