关于./xxx.h:error: no matching function for call to ‘std::basic_ofstream::basic_ofstream(std::__cxx11::string&, const openmode&)’ ofstream fout(path,ios::app);问题解决

经排查原因来自于gcc版本升级后新加入的内置方法

升级gcc版本:

yum -y install centos-release-scl#安装新版centos依赖

yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils#gcc临时升级

临时切换gcc版本为开发版本

scl enable devtoolset-9 bash

echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile#长期保持开发版本

问题即可得到解决

image-20210327232624052

image-20210327232654227