Centos6升级GCC到4.7

用gcc4.4.7编译的时候提示不支持c11,于是只能升级到4.7,(增加了55M,其实是不想升级的)。

[root@01314.CN ~]# cd /etc/yum.repos.d
[root@01314.CN yum.repos.d]# wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo 
[root@01314.CN yum.repos.d]# yum --enablerepo=testing-1.1-devtools-6 install devtoolset-1.1-gcc devtoolset-1.1-gcc-c++

如果报错[Errno 14] problem making ssl connection,请执行yum install ca-certificates,即可。

安装文件放置位置在:/opt/centos/devtoolset-1.1
具体程序文件位置在:/opt/centos/devtoolset-1.1/root/usr/bin/*

使用最新的gcc环境,所以要替换本地的,使用软连接来完成(也可以设置环境变量,看自己喜好)

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/centos/devtoolset-1.1/root/usr/bin/gcc /usr/bin/gcc
ln -s /opt/centos/devtoolset-1.1/root/usr/bin/c++ /usr/bin/c++
ln -s /opt/centos/devtoolset-1.1/root/usr/bin/g++ /usr/bin/g++
gcc --version

或者可能需要设置一下环境变量??

export CC=/opt/centos/devtoolset-1.1/root/usr/bin/gcc
export CPP=/opt/centos/devtoolset-1.1/root/usr/bin/cpp
export CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值