Install GCC5.3.0 under Linux (pro-test active)

Source: Internet
Author: User
Tags arithmetic gmp

For Linux small white, only need to know how to install, as for why wait for the study of Linux again. Knowledge is not the disadvantage of the system Ah!

First of all, the low-level version of GCC is preinstalled on Ubuntu, which can handle the C+class+stl style of the brush OJ, but because the cold

The fake is very stubborn to see C++primer, so only the compiler to upgrade to the latest version to meet the C++11/14 standard.

There are a few things you must do to install GCC :

1. GCC5.3.0 source code Compression package, this can go directly to the GCC FTP station to download. FileName is gcc-5.3.0.tar.gz (wget)

2. Four compressed packages:

M4 (i.e. an implementation of the traditional Unix macro processor),

GMP (i.e. GNU multiple Precision arithmetic Library),

MPFR (i.e. multiple-precision floating-point computations with correct rounding)

MPC (i.e. C library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding)

These packages can be found in the official FTP image station of GCC and can be temporarily extracted to the Temp folder.

Of these four packages, the first one can be installed by default in Ubuntu Software Center. The following four are not arbitrarily installed, in fact, they are according to GMP-->MPFR--->MPC-->GCC

In the order that they are installed.

Installation process: Note # post-comment

(1) Ubutu Software Center automatically download M4

(2) FTP download gmp-6.0.1, in the current directory,

Tar xvf gmp-6.1.0.tar.bz2

#在与gmp -6.1.0 A new folder in the same category, called temp (own name)

CD Temp

.. /gmp-6.1.0/configure–prefix=/usr/local/gmp-6.1.0 ------------#这句是说, the installation path is/usr/local/, named gmp-6.1.0;


Make
sudo make install

#安装好后, you can view the/usr/local/gmp-6.1.0 directory with three folders

(3) Download and install mpfr-3.1.3

#先清空temp内的文件, this installs two package complementary effects, 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 a dependent GMP library

Make

sudo make install

(4) Download and install mpc-1.0.3

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) Installing GCC-----The damn egg just started talking.

#再次清空temp首先配置GCC, execute the following command in the Temp folder, noting that temp and gcc-5.3.0 are in the same sibling directory at this time
.. /gcc-5.3.0/configure--prefix=/usr/local/gcc-5.3--enable-threads=posix--disable-checking--disable-multilib-- enable-languages=c,c++--with-gmp=/usr/local/gmp-6.1.0--with-mpfr=/usr/local/mpfr-3.1.3--with-mpc=/usr/local/ mpc-1.0.3

Make

Make install
#在配置时, for language language= options, you can select the language according to the compiler you want. , JAVA,OBC can be added in.
#至此GCC5.3 installation is complete.

Configuring Environment variables

There are two versions of GCC in the system, one is/USR/BIN/GCC and the other is/usr/local/gcc-5.3/if you do not modify the environment variable, you need to specify the path each time you call the 5.3 version of GCC. For ease of use, you can make a symbolic link in the/usr/bin directory

Cd/usr/bin
Ln-s/USR/LOCAL/GCC-5.3/BIN/GCC gcc53
Ln-s/usr/local/gcc-5.3/bin/g++ g++53

This allows you to use gcc53 g++53 to invoke the program, and the old version of gcc,g++ can still be applied.

For the library path also need to be set, so that in the call library functions can be applied to the new version of the compiler's library functions, in the Etc/profile file for root permissions to add the following code

export LD_LIBRARY_PATH=/usr/local/gcc-5.3/lib:/usr/local/gcc-5.3/lib64:$LD_LIBRARY_PATH

Log off and log back on to make the variable effective

At this point, gcc5.3 installation completed, resolved the above c++11 support.

              

Install GCC5.3.0 under Linux (pro-test active)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.