错误解释
CompileError!
编译信息
main.cpp: In function \xe2\x80\x98int* getnext(std::string)\xe2\x80\x99:\nmain.cpp:8: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 8 | while (j < t.size() - 1) {\n | ~~^~~~~~~~~~~~~~\nmain.cpp: In function \xe2\x80\x98void Kmp(std::string, std::string)\xe2\x80\x99:\nmain.cpp:27: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 27 | while (i < s.size() && j < t.size()) {\n | ~~^~~~~~~~~~\nmain.cpp:27:34: 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 27 | while (i < s.size() && j < t.size()) {\n | ~~^~~~~~~~~~\nmain.cpp:28:32: error: \xe2\x80\x98str\xe2\x80\x99 was not declared in this scope; did you mean \xe2\x80\x98std\xe2\x80\x99?\n 28 | if (j == -1 || str[i] == str[j]) {\n | ^~~\n | std\nmain.cpp:37:15: warning: suggest parentheses around assignment used as truth value [-Wparentheses]\n 37 | if (j = t.size()) {\n | ~~^~~~~~~~~~\nmain.cpp: In function \xe2\x80\x98int main()\xe2\x80\x99:\nmain.cpp:53:9: error: \xe2\x80\x98KMP\xe2\x80\x99 was not declared in this scope; did you mean \xe2\x80\x98Kmp\xe2\x80\x99?\n 53 | KMP(s, t);\n | ^~~\n | Kmp\nmain.cpp:54:26: 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 54 | for (int i = 0;i < t.size();i++) {\n | ~~^~~~~~~~~~\nmain.cpp:55:29: error: invalid types \xe2\x80\x98<unresolved overloaded function type>[int]\xe2\x80\x99 for array subscript\n 55 | cout << next[i] << " ";\n | ^\n