error C2059: syntax error : ')'
时间: 2024-05-17 22:15:21 浏览: 9
这个错误通常是由于括号不匹配导致的。在 C++ 中,括号必须成对出现,并且左括号和右括号的数量必须相等。如果你在代码中看到类似于 `error C2059: syntax error : ')'` 的错误提示,通常是因为你的代码中有括号不匹配的问题,比如:
- 缺少左括号,比如 `(a + b) * c)`,这里缺少了一个左括号;
- 缺少右括号,比如 `((a + b) * c`,这里缺少了一个右括号;
- 左右括号数量不匹配,比如 `(a + b) * (c + d`,这里左右括号数量不匹配。
如果你遇到了这个错误,你需要仔细检查你的代码,找到括号不匹配的问题并进行修正。另外,这个错误有时也可能是因为其他语法错误导致的,你可以检查一下代码中是否有其他语法错误。
相关问题
error C2059:syntax reeor:‘type’
This error indicates that there is a syntax error related to a type declaration in your code.
For example, if you have a line of code that declares a variable, but the type of the variable is not specified correctly, you may see this error.
To fix this error, check your code for any type declarations and make sure they are written correctly. Double-check the spelling, capitalization, and punctuation of the type name. If you are still having trouble, try looking up the correct syntax for the type declaration you are using.
cpp(62) : error C2059: syntax error : '[' D:\VC6.0\Microsoft Visual Studio\MyProjects\anagram\permSearch.cpp(62) : error C2143: syntax error : missing ')' before '{' D:\VC6.0\Microsoft Visual Studio\MyProjects\anagram\permSearch.cpp(62) : error C2143: syntax error : missing ')' before '{' D:\VC6.0\Microsoft Visual Studio\MyProjects\anagram\permSearch.cpp(62) : error C2143: syntax error : missing ';' before '{' D:\VC6.0\Microsoft Visual Studio\MyProjects\anagram\permSearch.cpp(62) : error C2065: 'c' : undeclared identifier D:\VC6.0\Microsoft Visual Studio\MyProjects\anagram\permSearch.cpp(62) : error C2059: syntax error : ')' D:\VC6.0\Microsoft Visual Studio\MyProjects\anagram\permSearch.cpp(62) : error C2143: syntax error : missing ';' before '!=' D:\VC6.0\Microsoft Visual Studio\MyProjects\anagram\permSearch.cpp(62) : error C2059: syntax error : ')' D:\VC6.0\Microsoft Visual Studio\MyProjects\anagram\permSearch.cpp(63) : error C2143: syntax error : missing ';' before '{'
根据错误提示,第62行代码可能存在语法错误,缺少一些括号、分号和变量声明。可能的问题可能是缺少左括号、右括号或分号,或者变量名拼写错误。你需要检查第62行的代码,确保语法正确并声明所需的变量。
另外,由于你使用的是VC6.0编译器,这个版本的编译器可能已经过时,不再被官方支持。建议使用更现代的编译器,比如Visual Studio 2019或者gcc等,以获得更好的编译效果和更好的语法提示。