Gcc 4.8.1 is the first compiler that fully supports C ++ 11. mingw can be installed on Windows and downloaded from sourceforge for ease of installation. To install it on Linux, you must first install some dependent libraries. Gcc4.6.3 is installed in Ubuntu 12.04 lts by default. In fact, this version also supports some c ++ 11 features, you can use these features by adding the "-std = c ++ 0x" Compilation option, but the multi-threaded library is poorly supported. gcc 4.8.1 is installed through ppa, therefore, you need to install ppa repository. The installation steps are as follows:
First install the dependency:
Sudo apt-get install libgmp-dev
Sudo apt-get install libmp Fr4 libmp fr-dev
Sudo apt-get install libmp C-dev libmpc2
Sudo apt-get install libtool
Sudo apt-get install m4
Sudo apt-get install bison
Sudo apt-get install flex
Sudo apt-get install autoconf
Next, go to the main steps to install gcc4.8.1:
Sudo add-apt-repository ppa: ubuntu-toolchain-r/test
Sudo apt-get update
Sudo apt-get install gcc-4.8
Sudo apt-get install g ++-4.8
Sudo apt-get install gcc-4.8-multilib
Sudo apt-get install g ++-4.8-multilib
Sudo apt-get install gcc-4.8-doc
Sudo update-alternatives -- install/usr/bin/gcc/usr/bin/gcc-4.8 20
Sudo update-alternatives -- install/usr/bin/g ++-4.8 20
Sudo update-alternatives -- config gcc
Sudo update-alternatives -- config g ++
Sudo apt-get update
Sudo apt-get upgrade-y
Sudo apt-get dist-upgrade
Then you can use it. You can use the gcc-v command to view the current gcc version:
If the network conditions are poor, the installation process is slow. You can use the source of Netease or sohu to increase the installation speed.