1. 为什么要升级到gcc4.9.x呢?
因为最近在做的一个项目中要用C++11新特性,而在 g++ 4.9 之前,regex 库并不支持 ECMAScript 的正则语法,换句话说,在 g++4.9 之前,g++ 对 C++11 标准库的支持并不完善,为保证本次项目的顺利进行,故将 g++ 版本升级至 4.9 以上。
2. 不是g++,而是gcc?
G++ is no longer a separate distribution. Version 2 of G++ is an integral
part of GCC. You should get the gcc-2.n.tar.gz sources (where n is the
highest numbered archive) in the gcc/ directory.
C++ users will almost certainly need to retrieve the libstdc+±2.n.tar.gz
distribution as well, since that’s where all the standard C++ stream classes
(and header files like iostream.h) live.
3. 安装过程:
3.1. 下载源码:
wget ftp://mirrors.kernel.org/gnu/gcc/gcc-4.9.4/gcc-4.9.4.tar.bz2
其他版本:mirrors.kernel.org/gnu/gcc
3.2. 解压文件:
tar -jxvf gcc-4.9.4.tar.bz2
3.3. 下载编译所需依赖项:
进入文件夹
cd gcc-4.9.4