我是 cpp 矢量新手,我一直遇到这个问题
\nerror: no matching function for call to \xe2\x80\x98push_back(const char [6])\xe2\x80\x99
#include <vector>\n#include <iostream>\nusing namespace std;\nint main() {\n vector<int> names;\n names.push_back("Lewis");\n names.push_back("Mark");\n names.push_back("Reece");\n names.push_back("Max");\n for(int i = 0; i < names.size(); i++)\n cout << names[i] << \'\\n\';\n return 0;\n}\nRun Code Online (Sandbox Code Playgroud)\n这是错误
\ntest.cpp: In function \xe2\x80\x98int main()\xe2\x80\x99:\ntest.cpp:6:26: error: no matching function for call to \xe2\x80\x98push_back(const char [6])\xe2\x80\x99\n 6 | names.push_back("Lewis");\n | ^\nIn file included from /usr/include/c++/9/vector:67,\n from test.cpp:1:\n/usr/include/c++/9/bits/stl_vector.h:1184:7: note: candidate: \xe2\x80\x98void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp …Run Code Online (Sandbox Code Playgroud)