C++:错误:expected unqualified-id before ‘=’ token

文章目录

错误

]oot@rhel-cleanmodules:~/mzhan017/test/c++[root@rhel-cleanmodules c++]# g++ auto.cpp
auto.cpp: In function ‘int main()’:
auto.cpp:25:10: error: expected unqualified-id before ‘=’ token
 int auto =3;

原因

因为auto 是一个关键字,不能作为变量名出现。

如果将auto 作为函数名,出现下列错误:

auto.cpp:7:10: error: expected unqualified-id before ‘bool’
 int auto(bool auto_f, int aconf_other_auto_respoonse)
          ^~~~
auto.cpp:7:10: error: expected ‘)’ before ‘bool’
 int auto(bool auto_f, int aconf_other_auto_respoonse)
上一篇:Python 新特性


下一篇:[Vue warn]: Invalid prop: type check failed for prop “image“. Expected String, got Null.