centos7自带的gcc版本是4.8,手动升级安装很锻炼。
毕竟已经0202年了
devtoolset-7 - Developer Toolset is designed for developers working on CentOS or Red Hat Enterprise Linux platform. It provides current versions of the GNU Compiler Collection, GNU Debugger, and other development, debugging, and performance monitoring tools.
可以通过安装devtoolset的方式间接升级gcc至高版本
sudo yum install centos-release-scl
sudo yum install devtoolset-7-gcc*
sudo yum install devtoolset-7-gdb*
# debuginfo-install libgcc-4.8.5-39.el7.x86_64 libstdc++-4.8.5-39.el7.x86_64
scl enable devtoolset-7 bash
which gcc
gcc --version
这里有一个问题,就是重启之后可能不能用gcc,那么就要再次运行这个命令:
scl enable devtoolset-7 bash