Compile gcc4.7lambda expressions in centos. it is not easy to love you. STL provides many algorithms but does not provide anonymous functions. it is a sin! The story of this article begins. C ++ 0x brings us a spring breeze and provides lambda expressions. we can finally write a program like c...
Compile gcc4.7 lambda expressions in centos and it is not easy to love you. STL provides many algorithms but does not provide anonymous functions. it is a sin! The story of this article begins. C ++ 0x brings us a spring breeze and provides lambda expressions. we can finally write programs like c. Int a, B; for_each (v. begin (), v. end (), [=] (int & it) {it = it * a + B;}); because www.2cto.com is usually developed under vs2010, it is only noticed during deployment, the gcc version 4.4 in centos6 does not support lambda. it should be supported by at least 4.5. 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! First, get the code out.
Install the following package. Otherwise, you may lose the link to libc. a error sudo yum install glibc-static libstdc ++-staticwget http://ftp.gnu.org/gnu/gcc/gcc-4.7.0/gcc-4.7.0.tar.gz tar xzf gcc-4.7.0.tar.gz cd gcc-4.7.0 www.2cto.com. /contrib/download_prerequisites cd .. mkdir build_gcc4.7cd build_gcc4.7 .. /gcc-4.7.0/configure -- enable-checking = release -- enable-languages ages = c, c ++ -- disable-multilibmake-j4sudo make install after I spent more than an hour on the server .. Slow down the machine .. Many articles say that it is irrational to download the source code of the three libraries, such as the archive file, and compile the source code by yourself, which wastes a lot of time, because we may encounter version problems and path problems when downloading, installing, and installing on our own, a good solution should be used. /contrib/download_prerequisites, which is automatically downloaded and compiled.
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