问题:[Error] no matching function for call to 'std::basic_ofstream::basic_ofstream(std::string&) 代码 void test(string filename) { ofstream fileQuantify(filename); fileQuantify << "很帅" << endl; } 修改: void test(string filename) { ofstream fileQuantify(filename.cstr()); fileQuantify << "很帅" << endl; }