首页 > 系统相关 >centos7 编译cpp报错 /usr/include/c++/4.8.2/iostream:38:28: 致命错误:bits/c++config.h:没有那个文件或目录 #include <

centos7 编译cpp报错 /usr/include/c++/4.8.2/iostream:38:28: 致命错误:bits/c++config.h:没有那个文件或目录 #include <

时间:2022-10-09 14:35:24浏览次数:65  
标签:bin gcc devtoolset c++ 报错 usr include

解决方法:升级gcc编译器

 

Centos7升级gcc

安装centos-release-scl 安装devtoolset 

注意,如果想安装7.版本的,就改成devtoolset-7-gcc,以此类推

sudo yum install centos-release-scl  devtoolset-8-gcc* 

激活对应的devtoolset

scl enable devtoolset-8-gcc*

 

验证gcc版本

gcc -v

 

此时gcc版本号会变成8.*  但退出当前会话后,gcc版本还是会变成之前的,这种激活是零时的。

如果想永久升级,需要给刚下在的新版本编译器建立软连接。

备份当前版本编译器:

  cp  /usr/bin/gcc /usr/bin/gcc.4.8.5

 sudo ln -s /opt/rh/devtoolset-8/root/usr/bin/g++ g++
sudo ln -s /opt/rh/devtoolset-8/root/usr/bin/gcc  gcc


 

完毕!

 




 

 

标签:bin,gcc,devtoolset,c++,报错,usr,include
From: https://www.cnblogs.com/guokaixuan/p/16771992.html

相关文章