For Linux Xiaobai, you only need to know how to install it. As for why you have learned Linux, let's talk about it. . .
First of all, generally, a low-level version of gcc is pre-installed on ubuntu, which can fully cope with the style of C + Class + STL when OJ is brushed. version.
Several things necessary to install GCC:
1.gcc5.4.0 source code compression package, download address:
Mirror Site: https://gcc.gnu.org/mirrors.html
Speed is pretty good: ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/
2. Four compression packages:
m4: http://www.gnu.org/software/m4/m4.html
gmp: https://gmplib.org/
mpfr: http://www.mpfr.org/
mpc: http://www.multiprecision.org/
The above five packages cannot be installed at will, and need to be installed in the order of m4-> gmp-> mpfr ---> mpc-> gcc
Install gcc5.4.0 under Ubuntu14.04 (install it yourself)
Installation process: # is followed by comments
1. Download and install m4
gunzip m4-1.4.16.tar.gz
tar -xvf m4-1.4.16.tar
cd m4-1.4.16 /
./configure
make
sudo make install
2. Download and install gmp-6.1.2
tar -Jxvf gmp-6.1.2.tar.xz
mkdir temp #Create a new folder in the same level as gmp-6.1.2, named temp (name yourself)
cd temp
../gmp-6.1.2/configure --prefix = / usr / local / gmp-6.1.2 ------------ # This sentence says that the installation path is / usr / local / Name is gmp-6.1.2;
make
sudo make install
#After installation, you can view three folders under /usr/local/gmp-6.1.2
3. Download and install mpfr-3.1.3
unzip mpfr-3.1.3.zip
cd temp
#First empty the files in temp so that the two packages are installed to complement each other. Of course, you can also create a new folder under your new folder:
../mpfr-3.1.3/configure --prefix = / usr / local / mpfr-3.1.3 --with-gmp = / usr / local / gmp-6.1.0 # prefix is the installation path, with is dependent gmp library
make
sudo make install
4. Download and install mpc-1.0.3
tar -zxvf mpc-1.0.3.tar.gz
cd temp
#Also empty the temp folder first
../mpc-1.0.3/configure --prefix = / usr / local / mpc-1.0.3 --with-gmp = / usr / local / gmp-6.1.0 --with-mpfr = / usr / local / mpfr- 3.1.3
make
sudo make install
5. Install gcc5.4.0
tar -zxvf gcc-5.4.0.tar.gz
#Empty temp again first configure GCC, execute the following command in the temp folder, note that at this time temp and gcc-5.4.0 are in the same directory
../gcc-5.4.0/configure --prefix = / usr / local / gcc-5.4 --enable-threads = posix --disable-checking --disable-multilib --enable-languages = c, c ++- with-gmp = / usr / local / gmp-6.1.2 --with-mpfr = / usr / local / mpfr-3.1.3 --with-mpc = / usr / local / mpc-1.0.3
make
sudo make install
#When configuring, for the language == option, you can choose the language according to the compiler you need. , Java, obc can be added
#So far GCC5.4 is installed.
Configure environment variables
At this time, there are two versions of gcc in the system, one is / usr / bin / gcc and the other is /usr/local/gcc-5.4/ If you do not modify the environment variables, you need to specify each time you call gcc version 5.4 path. For ease of use, you can make a symbolic link in the / usr / bin directory
sudo ln -s /usr/local/gcc-5.4/bin/gcc / usr / local / bin / gcc54
sudo ln -s /usr/local/gcc-5.4/bin/g++ / usr / local / bin / g ++ 54
In this way, you can use gcc54 and g ++ 54 to call the program. Older versions of gcc and g ++ can still be used.
The library path also needs to be set so that the library functions of the new version of the compiler can be applied when calling the library functions. The root permission is added in the etc / profile file.
export LD_LIBRARY_PATH = / usr / local / gcc-5.4 / lib: /usr/local/gcc-5.4/lib64: $ LD_LIBRARY_PATH
Log out and log in again for the variables to take effect
At this point, gcc5.4 is installed and the above C ++ 11 support issues are resolved.
Reference:
Install GCC5.3.0 under Linux (pro test effective)
GCC5.4 installation
Error installing m4-1.4.16.tar.gz when installing autoconf