Tru Huynh of centos.org has built the redhat developer toolset 1.1, for centos and it contains gcc 4.7.2
So you could simply use his repo and install just gcc, instantly.
Code: Select all
cd /etc/yum.repos.d
wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo
yum --enablerepo=testing-1.1-devtools-6 install devtoolset-1.1-gcc devtoolset-1.1-gcc-c++
This will install it most likely into /opt/centos/devtoolset-1.1/root/usr/bin/
Then you can tell your compile process to use the gcc 4.7 instead of 4.4 with the CC variable
Code: Select all
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++
And last thing:
Replace your installed gcc to your symlinks, and you will have the gcc 4.7 to allow of C++11 standard
Code: Select all
mv /usr/bin/gcc /usr/bin/gcc_old
mv /usr/bin/cpp /usr/bin/cpp_old
mv /usr/bin/c++ /usr/bin/c++_old
mv /usr/bin/g++ /usr/bin/g++_old
ln -s /opt/centos/devtoolset-1.1/root/usr/bin/gcc /usr/bin/gcc
ln -s /opt/centos/devtoolset-1.1/root/usr/bin/cpp /usr/bin/cpp
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++


