CentOS升级gcc

前端之家收集整理的这篇文章主要介绍了CentOS升级gcc前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

(1)获取最新的 repo,并安装:

wget http://people.centos.org/tru/devtools-2/devtools-2.repo
mv devtools-2.repo /etc/yum.repos.d
yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++

被安装的目录:/opt/rh/devtoolset-2/root/

(2)更新链接

mv /usr/bin/gcc /usr/bin/gcc-4.4.7
mv /usr/bin/g++ /usr/bin/g++-4.4.7
mv /usr/bin/c++ /usr/bin/c++-4.4.7
ln -s /opt/rh/devtoolset-2/root/usr/bin/gcc /usr/bin/gcc
ln -s /opt/rh/devtoolset-2/root/usr/bin/c++ /usr/bin/c++
ln -s /opt/rh/devtoolset-2/root/usr/bin/g++ /usr/bin/g++

(3)查看当前版本:

gcc --version
#gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
#Copyright (C) 2013 Free Software Foundation,Inc.
#This is free software; see the source for copying conditions.  There is NO
#warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

猜你在找的CentOS相关文章