1. Download the latest GCC source package 2.解压缩 tar -xf gcc-4.9.1.tar.gz
3.cd gcc-4.9.1
4. Run the Download_prerequisites script, ./contrib/download_prerequisites
This script will automatically help you to download the required dependent files and libraries
5. Create the output directory and place all the intermediate files in the directory.
cd gcc_temp
6. Run 7. make & make install
============================================================================================
This article mainly introduces how to upgrade GCC to support c++11 under Linux system . GCC is currently the most supported compiler for C++11, but requires GCC4.8 and above.
This article uses the operating system: Centos 6.4 desktop,64bit;
Original GCC version: 4.4.7;
Objective: To upgrade GCC to 4.8.2 to support c++11.
Get gcc 4.8.2 package: wget http://gcc.skazkaforyou.com/releases/gcc-4.8.2/gcc-4.8.2.tar.gz;
Decompression: TAR-XF gcc-4.8.2.tar.gz;
Go to directory gcc-4.8.2, run:./contrib/download_prerequisites. This magical script file will help us to download, configure and install dependent libraries, which can save us a lot of time and effort.
Set up the output directory and go to the directory: mkdir GCC-BUILD-4.8.2;CD gcc-build-4.8.2;
.. /configure–enable-checking=release–enable-languages=c,c++–disable-multilib. –enable-languages says you want your GCC to support those languages, –disable-multilib does not generate a cross-compiler that compiles executable code to other platforms. The compiler generated by –disable-checking does not perform additional checks during compilation, or it can use –enable-checking=xxx to add some checks;
Compile: Make; note this step and the previous step, more time-consuming;
Installation: make install;
Verification: gcc-v, or g++-V, if the GCC version shown is still the previous version, you will need to restart the system, or you can view the installation location of GCC: which GCC, and then in view version/usr/local/bin/gcc-v, usually GCC is installed at that location, if displayed as;
C++11 features GCC source package