9 16 C:\Users\86152\Documents\c语言(1)\打杂2.cpp [Error] expected primary-expression before '[' token
时间: 2023-09-27 16:11:46 浏览: 42
这个错误通常表示在某个地方使用了不正确的语法,导致编译器无法理解代码的含义。错误信息 `[Error] expected primary-expression before '[' token` 中的 `expected primary-expression` 表示编译器希望在 `[` 符号之前看到一个主表达式(如变量名、常量、函数调用等),但它没有找到这样的表达式。
这种错误可能是因为:
- 变量名或函数名拼写错误,导致编译器找不到该名称
- 括号不匹配,导致表达式语法不正确
- 数组下标使用了非整数类型,或者下标越界
你需要检查代码中使用 `[` 符号的地方,找出语法错误,并进行修正。如果无法解决问题,可以将出错的代码和完整的错误信息一起提供,以便更好地帮助你。
相关问题
4 1 C:\Users\Administrator\Desktop\最大公约数.cpp [Error] expected primary-expression before 'public'
这个错误提示通常是因为在代码中使用了不正确的语法。根据错误提示来看,似乎是在最大公约数.cpp文件中的某个位置出现了问题。
根据你提供的错误提示,可能会有以下几种情况导致这个错误:
1. 在代码中使用了保留关键字public作为标识符。请确保你没有将public作为变量名或函数名等标识符使用。
2. 可能是在代码中缺少了分号或其他语法错误,导致编译器无法正确解析代码。请检查你的代码是否存在这些问题。
3. 可能是在代码中的其他位置出现了错误,而这个错误导致了后续的语法解析错误。建议你仔细检查代码,尤其是在错误提示附近的代码。
如果你能提供更多的代码内容或者错误提示的上下文,我可以更具体地帮助你解决问题。
6 14 C:\Users\admin\Desktop\日常.cpp [Error] expected primary-expression before '||' token
This error is indicating that there is an issue with the syntax in your code. Specifically, it is saying that there is an unexpected symbol before the "||" token.
To fix this error, you need to look at the code around where the error is occurring and check for any syntax errors. It is possible that you are missing a closing parenthesis or a semicolon, or that you have an extra symbol that is causing the issue.
Once you have identified the syntax error, fix it and try compiling your code again. If you still encounter errors, repeat the process until all errors have been resolved.