Compile gcc4.7 in centos

Source: Internet
Author: User

Lambda expressions are not easy to love you. STL provides us with a lotAlgorithmIt is a sin to provide anonymous functions!

The story of this article begins.

C ++ 0x brings us a spring breeze and provides lambda expressions. We can finally write data like C #.Program.

Int A, B;

For_each (V. Begin (), V. End (), [=] (Int & IT) {It = It * A + B ;});

 

Because it is developed under vs2010 at ordinary times, it is noticed during deployment that the GCC version 4.4 in centos6 does not support lambda. It must be supported at least in version 4.5.

All right, since 4.7 is coming, compile it.

After a Google attack, many of my colleagues wrote complex statements and made them more complex. I had a lot of detours and hoped to provide some help to others!

FirstCodeGet it out

Install the following package. Otherwise, you may fail to get the libc. A error.

Sudo Yum install glibc-static libstdc ++-static

Wget http://ftp.gnu.org/gnu/gcc/gcc-4.7.0/gcc-4.7.0.tar.gz

Tar xvf gcc-4.7.0.tar.gz

CD gcc-4.7.0

./Contrib/download_prerequisites

CD ..

Mkdir build_gcc4.7

CD build_gcc4.7

../Gcc-4.7.0/configure -- enable-checking = release -- enable-packages ages = C, C ++ -- disable-multilib

Make-J4

Sudo make install

I spent more than an hour on the server .. Slow down the machine ..

ManyArticleThey all said they were downloading the source code of the three libraries, such as the archive file, and compiling the source code by themselves, which was quite irrational and wasted a lot of time, because we may encounter version problems and Path Problems When downloading, installing, and installing on our own, a good solution is still

When using./contrib/download_prerequisites, it will automatically download and compile automatically.

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.