: error: cannot convert ‘const string {aka const std::basic_string<char>}’ to ‘const char*’ for argument ‘1’ to ‘int rename(const char*, const char*)’
std::rename(old_img_path,new_img_path);
出错代码
const std::string old_img_path=result_path + to_string(img_name_flag) + "_mesh.jpg";
const std::string new_img_path=result_path+to_string(frame.timestamp_)+"_mesh.jpg";
std::cout<<"old_img_path:"<<old_img_path<<std::endl;
std::cout<<"new_img_path:"<<new_img_path<<std::endl;
std::rename(old_img_path,new_img_path);
//将上行代码修改至下行即可
std::rename(old_img_path.c_str(),new_img_path.c_str());