CentOS升级gcc gcc-c++到4.8版本

1.使用 redhat developer toolset 1.1 的repo,安装GCC

cd /etc/yum.repos.d

wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo

yum --enablerepo=testing-devtools-2-centos-6 install devtoolset-2-gcc devtoolset-2-gcc-c++

2. 替换系统中原来的GCC

通过通过第一步会把 GCC 安装到以下目录:

/opt/rh/devtoolset-2/root/usr/bin

接下来需要修改系统的配置,使默认的 gcc 和 g++ 命令使用的是新安装的版本。

ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
hash -r

现在查看 g++ 的版本号:

#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.

已经从4.4.7升级到4.8.2了。

转载于:https://my.oschina.net/u/583362/blog/682123

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值