From this answer to "Install gcc 4.7 on CentOS [6.x]", the easiest way to get g++ 4.7, and the required tools and libraries, for CentOS 5.x is via the devtools package:

cd /etc/yum.repos.d
wget http://people.centos.org/tru/devtools/devtools.repo
yum --enablerepo=testing-devtools-5 install devtoolset-1.0

Since you're running g++ manually (as opposed to through make), you'll need to update your $PATHvariable so your shell will use the new gccg++, etc. binaries:

export PATH=/opt/centos/devtoolset-1.0/root/usr/bin/:$PATH

At this point, your g++ should be version 4.7.0

$ g++ --version
g++ (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5)
Copyright (C) 2012 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.

Be aware that installing gcc and associated tools and libraries in this manner relies on the repository maintainer to keep their packages up to date.

If you're interested in keeping your gcc up to date, you may want to consider building gcc from source.

Also, compiling programs with a different version of g++ and libstdc++ than are installed on your system can cause all kinds of Fun, coping with which is beyond the scope of this answer. It may be worth moving to a Linux distribution that has support for what you're doing.

CentOS yum 安装 g++ 4.7.2 & c++11的更多相关文章

  1. centos 怎么安装 g++

    centos 怎么安装 g++ 找了n久  找到一个实用的 有gcc  但是 是老版本的  tarball 编译 nmap 的时候说机器没有g++ 各种方法都试过 然后 找到下面这个方法: cento ...

  2. centos yum 安装 mongodb 以及php扩展

    centos yum 安装 mongodb 以及php扩展 投稿:hebedich 字体:[增加 减小] 类型:转载 MongoDB是一个基于分布式文件存储的数据库.由C++语言编写.旨在为WEB应用 ...

  3. 【转】CentOS yum安装和卸载软件的使用方法

    在CentOS yum安装和卸载软件的使用方法安装方法安装一个软件时.   CentOS yum -y install httpd安装多个相类似的软件时   CentOS yum -y install ...

  4. CentOS yum 安装LAMP PHP5.4版本

    CentOS yum 安装LAMP PHP5.4版本 [日期:2015-06-04] 来源:Linux社区  作者:rogerzhanglijie [字体:大 中 小]     Linux系统版本:C ...

  5. CentOS yum安装mcrypt

    CentOS yum安装mcrypt   本篇排错的前提是只想用yum安装,不想使用源码包编译安装. php依赖一下包:   #yum install libmcrypt libmcrypt-deve ...

  6. CentOS yum安装mcrypt详细图解教程

    CentOS yum安装mcrypt详细图解教程 在Linux的发行版CentOS 6.3 系统下,LAMP(Linux+Apache+Mysql+php)环境搭建好后发现PHPMyadmin提示 “ ...

  7. centos yum 安装php5.6

    centos yum 安装php5.6 卸载 php之前的版本: yum remove -y php-common 配置源 CentOS 6.5的源 rpm -Uvh http://ftp.iij.a ...

  8. redhad借用CentOs yum 安装

    RedHat linux 默认是安装了yum软件的,但是由于激活认证的原因让redhat无法直接进行yum安装一些软件,如果我们需要在redhat下直接yum安装软件,我们只用把yum的源修改成Cen ...

  9. linux centos yum安装LAMP环境

    centos 6.5 1.yum安装和源代码编译在使用的时候没啥区别,但是安装的过程就大相径庭了,yum只需要3个命令就可以完成,源代码需要13个包,还得加压编译,步骤很麻烦,而且当做有时候会出错,源 ...

随机推荐

  1. 树的性质——cf1244D

    特别简单,只有链的形式才符合要求,那么枚举前两个点的颜色搞一下就可以 #include <bits/stdc++.h> using namespace std; ][],pos[],ok= ...

  2. Java-Class-C:java.util.BigDecimal

    ylbtech-Java-Class-C:java.util.BigDecimal 1.返回顶部   2.返回顶部   3.返回顶部   4.返回顶部 1. /* * Copyright (c) 19 ...

  3. Django+paramiko实现webshell

    说明 基于 python3.7 + django 2.2.3 实现的 django-webshell,支持颜色显示,支持 tab 命令补全,项目地址:https://github.com/leffss ...

  4. C# - 怎么截取字符串中指定字符及其后面的字符

    方法1:去掉空格以及后面的字符   //怎么截取让date的值为"2011/12/9",即去掉空格以及后面的字符   string date = "2011/12/9 2 ...

  5. delphi基础篇之数据类型之二:2.字符串类型

    2.字符串类型 2.1.ShortStringShortString 又称为短字符串(相对的,Ansistring.widestring.unicodestring 称为长字符串),其实质上是一个编译 ...

  6. HTTPS 加密机制

    目录 1. HTTPS 概述 2. 对称加密 3. 非对称加密 4. 非对称加密改良方案 5. 非对称加密 + 对称加密 6. 中间人攻击 7. 数字证书 8. 数字签名 9. HTTPS 工作原理 ...

  7. python_way day14 CSS,莫泰对话框

    python_way day14 CSS 层叠样式表 一.CSS作用域: 二.css标签选择器 三.css样式 四.莫泰对话框: 一.css作用域: 基本用法:style="样式" ...

  8. java.lang.Boolean.compareTo()方法实例

    compareTo接口 Comparable<Boolean>指定以下接口 参数 b - 布尔实例进行比较 返回值 方法返回 0 - 如果该对象表示相同的布尔值作为参数 一个正数值 - 如 ...

  9. JQuery中内容操作函数、validation表单校验

    JQuery:内容体拼接(可以直接拼接元素节点和内容节点) JQuery实现: 方案1:A.append(B); == B.appendTo(A);A的后面拼接B 方案2: A.prepend(B); ...

  10. Redis数据结构之压缩列表-ziplist

    为了节约内存,在zset和hash容器对象元素个数较少时,Redis会采用压缩列表(ziplist)进行存储. 压缩列表是一块连续的内存空间,元素之间紧挨着存储,不存在冗余 一个压缩列表可以包含任意多 ...