[Error] expected expression before 'struct'
时间: 2023-10-23 21:12:09 浏览: 377
expected primary-expression before token (解决方案).md
This error message is usually caused by a syntax error in your code. It means that the compiler was expecting to see an expression, such as a variable or a function call, but instead encountered the keyword "struct".
To resolve this error, you need to check your code for any syntax errors or typos that may be causing the problem. Make sure that any struct declarations are properly formatted and that you have used the correct syntax for calling functions or accessing variables.
For example, if you have defined a struct called "Person", you would need to use the following syntax to create a new instance of that struct:
```
struct Person p;
```
If you accidentally typed something like this instead:
```
Person p;
```
You would get the "expected expression before 'struct'" error message, because the compiler is expecting to see an expression (in this case, the struct declaration) before the variable name.
阅读全文