错误解释

CompileError!

编译信息

main.cpp:4:5: error: \xe2\x80\x98int index\xe2\x80\x99 redeclared as different kind of entity\n 4 | int index=1; //\xe4\xbb\x8e1\xe5\xbc\x80\xe5\xa7\x8b\xe7\x94\xa8\xe4\xbd\x9c\xe4\xb8\x8b\xe6\xa0\x87\xef\xbc\x8c\xe5\x90\x8c\xe6\x97\xb6\xe8\xae\xb0\xe5\xbd\x95\xe5\xae\x8c\xe6\x95\xb4\xe5\xb1\x82\xe5\xba\x8f\xe5\xa4\xa7\xe5\xb0\x8f\n | ^~~~~\nIn file included from /usr/include/string.h:462,\n from /usr/include/c++/11/cstring:42,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:48,\n from main.cpp:1:\n/usr/include/strings.h:61:1: note: previous declaration \xe2\x80\x98const char* index(const char*, int)\xe2\x80\x99\n 61 | index (const char *__s, int __c) __THROW\n | ^~~~~\nmain.cpp: In function \xe2\x80\x98void preorder(std::vector<int>&, int)\xe2\x80\x99:\nmain.cpp:7:23: error: invalid operands of types \xe2\x80\x98int\xe2\x80\x99 and \xe2\x80\x98<unresolved overloaded function type>\xe2\x80\x99 to binary \xe2\x80\x98operator>=\xe2\x80\x99\n 7 | if(Level[k]==-1||k>=index) //\xe7\xa9\xba\xe8\x8a\x82\xe7\x82\xb9\xe4\xb8\xba-1\n | ~^~~~~~~\nmain.cpp: In function \xe2\x80\x98int main()\xe2\x80\x99:\nmain.cpp:18:18: warning: comparison of integer expressions of different signedness: \xe2\x80\x98int\xe2\x80\x99 and \xe2\x80\x98std::__cxx11::basic_string<char>::size_type\xe2\x80\x99 {aka \xe2\x80\x98long unsigned int\xe2\x80\x99} [-Wsign-compare]\n 18 | for(int i=0;i<input.size();i++){ //\xe8\xbe\x93\xe5\x85\xa5\xe5\x85\x83\xe7\xb4\xa0\xe5\x8f\xaf\xe8\x83\xbd\xe6\x98\xaf\xe5\xa4\x9a\xe4\xbd\x8d\xe6\x95\xb0\n | ~^~~~~~~~~~~~~\nmain.cpp:25:22: warning: comparison of integer expressions of different signedness: \xe2\x80\x98int\xe2\x80\x99 and \xe2\x80\x98std::__cxx11::basic_string<char>::size_type\xe2\x80\x99 {aka \xe2\x80\x98long unsigned int\xe2\x80\x99} [-Wsign-compare]\n 25 | if((c==','||i==input.size()-1)&&!temp.empty()){\n | ~^~~~~~~~~~~~~~~~\nmain.cpp:33:20: error: no match for \xe2\x80\x98operator[]\xe2\x80\x99 (operand types are \xe2\x80\x98std::vector<int>\xe2\x80\x99 and \xe2\x80\x98<unresolved overloaded function type>\xe2\x80\x99)\n 33 | while(Level[index]==-1){\n | ^\nIn file included from /usr/include/c++/11/vector:67,\n from /usr/include/c++/11/queue:61,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:86,\n from main.cpp:1:\n/usr/include/c++/11/bits/stl_vector.h:1043:7: note: candidate: \xe2\x80\x98std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]\xe2\x80\x99\n 1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT\n | ^~~~~~~~\n/usr/include/c++/11/bits/stl_vector.h:1043:28: note: no known conversion for argument 1 from \xe2\x80\x98<unresolved overloaded function type>\xe2\x80\x99 to \xe2\x80\x98std::vector<int>::size_type\xe2\x80\x99 {aka \xe2\x80\x98long unsigned int\xe2\x80\x99}\n 1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT\n | ~~~~~~~~~~^~~\n/usr/include/c++/11/bits/stl_vector.h:1061:7: note: candidate: \xe2\x80\x98std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::const_reference = const int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]\xe2\x80\x99\n 1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT\n | ^~~~~~~~\n/usr/include/c++/11/bits/stl_vector.h:1061:28: note: no known conversion for argument 1 from \xe2\x80\x98<unresolved overloaded function type>\xe2\x80\x99 to \xe2\x80\x98std::vector<int>::size_type\xe2\x80\x99 {aka \xe2\x80\x98long unsigned int\xe2\x80\x99}\n 1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT\n | ~~~~~~~~~~^~~\nmain.cpp:34:18: error: no post-increment operator for type\n 34 | index++;\n | ^~\nmain.cpp:37:20: error: invalid operands of types \xe2\x80\x98int\xe2\x80\x99 and \xe2\x80\x98<unresolved overloaded function type>\xe2\x80\x99 to binary \xe2\x80\x98operator*\xe2\x80\x99\n 37 | Level[2*index]=Level[2*index+1]=-1;\n | ~^~~~~~\nmain.cpp:37:35: error: invalid operands of types \xe2\x80\x98int\xe2\x80\x99 and \xe2\x80\x98<unresolved overloaded function type>\xe2\x80\x99 to binary \xe2\x80\x98operator*\xe2\x80\x99\n 37 | Level[2*index]=Level[2*index+1]=-1;\n | ~^~~~~~\nmain.cpp:38:14: error: no match for \xe2\x80\x98operator[]\xe2\x80\x99 (operand types are \xe2\x80\x98std::vector<int>\xe2\x80\x99 and \xe2\x80\x98<unresolved overloaded function type>\xe2\x80\x99)\n 38 | Level[index]=n; index++;\n | ^\nIn file included from /usr/include/c++/11/vector:67,\n from /usr/include/c++/11/queue:61,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:86,\n from main.cpp:1:\n/usr/include/c++/11/bits/stl_vector.h:1043:7: note: candidate: \xe2\x80\x98std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]\xe2\x80\x99\n 1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT\n | ^~~~~~~~\n/usr/include/c++/11/bits/stl_vector.h:1043:28: note: no known conversion for argument 1 from \xe2\x80\x98<unresolved overloaded function type>\xe2\x80\x99 to \xe2\x80\x98std::vector<int>::size_type\xe2\x80\x99 {aka \xe2\x80\x98long unsigned int\xe2\x80\x99}\n 1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT\n | ~~~~~~~~~~^~~\n/usr/include/c++/11/bits/stl_vector.h:1061:7: note: candidate: \xe2\x80\x98std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::const_reference = const int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]\xe2\x80\x99\n 1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT\n | ^~~~~~~~\n/usr/include/c++/11/bits/stl_vector.h:1061:28: note: no known conversion for argument 1 from \xe2\x80\x98<unresolved overloaded function type>\xe2\x80\x99 to \xe2\x80\x98std::vector<int>::size_type\xe2\x80\x99 {aka \xe2\x80\x98long unsigned int\xe2\x80\x99}\n 1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT\n | ~~~~~~~~~~^~~\nmain.cpp:38:31: error: no post-increment operator for type\n 38 | Level[index]=n; index++;\n | ^~\nmain.cpp:40:17: error: no matching function for call to \xe2\x80\x98std::vector<int>::resize(<unresolved overloaded function type>)\xe2\x80\x99\n 40 | Level.resize(index);\n | ~~~~~~~~~~~~^~~~~~~\nIn file included from /usr/include/c++/11/vector:67,\n from /usr/include/c++/11/queue:61,\n from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:86,\n from main.cpp:1:\n/usr/include/c++/11/bits/stl_vector.h:937:7: note: candidate: \xe2\x80\x98void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]\xe2\x80\x99\n 937 | resize(size_type __new_size)\n | ^~~~~~\n/usr/include/c++/11/bits/stl_vector.h:937:24: note: no known conversion for argument 1 from \xe2\x80\x98<unresolved overloaded function type>\xe2\x80\x99 to \xe2\x80\x98std::vector<int>::size_type\xe2\x80\x99 {aka \xe2\x80\x98long unsigned int\xe2\x80\x99}\n 937 | resize(size_type __new_size)\n | ~~~~~~~~~~^~~~~~~~~~\n/usr/include/c++/11/bits/stl_vector.h:957:7: note: candidate: \xe2\x80\x98void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = int]\xe2\x80\x99\n 957 | resize(size_type __new_size, const value_type& __x)\n | ^~~~~~\n/usr/include/c++/11/bits/stl_vector.h:957:7: note: candidate expects 2 arguments, 1 provided\n