Expected primary expression.
时间: 2024-06-06 20:07:03 浏览: 152
An expected primary expression is an error message that occurs when a programming language compiler encounters a syntax error in the code. It indicates that the compiler was expecting a valid primary expression, such as a variable, constant, or literal value, but instead encountered an unexpected token or symbol. This error can occur in various programming languages, including C++, Java, Python, and JavaScript, and typically requires the programmer to review the code and correct the syntax error in order to resolve the issue.
相关问题
expected primary expression.
"expected primary expression" 的意思是 "期望主要表达式",通常是编程语言中的错误提示,表示在代码中缺少了必要的主要表达式。这可能是由于语法错误、拼写错误、缺少分号等问题引起的。需要仔细检查代码,找出并修复错误。
AnonymousVoting.sol:729:7: Error: Expected primary expression. enum State { NOT_STARTED, IN_PROGRESS, FINISHED }; ^
这个错误是因为在枚举类型声明的结尾处添加了分号`;`,这是不正确的语法。枚举类型声明应该像下面这样:
```
enum State { NOT_STARTED, IN_PROGRESS, FINISHED }
State public state;
```
在这里,我们声明了一个名为`State`的枚举类型,并且我们没有在枚举类型声明的结尾处添加分号。然后,我们声明了一个名为`state`的公共状态变量,该变量的类型为`State`。
请注意,枚举类型声明应以大括号`{}`结束,而不是分号`;`。如果还有其他错误,请检查您的代码是否有其他语法错误。
阅读全文