码迷,mamicode.com
首页 > 其他好文 > 详细

GCC5.4安装

时间:2016-07-12 17:18:08      阅读:303      评论:0      收藏:0      [点我收藏+]

标签:

1.下载

镜像站点:https://gcc.gnu.org/mirrors.html

速度还不错的:ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/

2.解压安装依赖库

./contrib/download_prerequisites

3.配置

./configure --disable-multilib(不生成编译为其他平台可执行代码的交叉编译器)

4.编译安装

make && make install

5.测试代码

#include <iostream>
#include <string>
#include <iterator>
#include <algorithm>
#include <array>
 
int main()
{
    // construction uses aggregate initialization
    std::array<int, 3> a1{ {1,2,3} };  // double-braces required
    std::array<int, 3> a2 = {1, 2, 3}; // except after =
    std::array<std::string, 2> a3 = { {std::string("a"), "b"} };
 
    // container operations are supported
    std::sort(a1.begin(), a1.end());
    std::reverse_copy(a2.begin(), a2.end(), 
                      std::ostream_iterator<int>(std::cout, " "));
 
    std::cout << ‘\n‘;
 
    // ranged for loop is supported
    for(auto& s: a3)
        std::cout << s << ‘ ‘;
    std::cout << ‘\n‘;    
}

 

如果出现如下报错:

/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21‘ not found (required by ./test)

更新软连接即可:

/usr/lib64/libstdc++.so.6 -> /usr/lib64/libstdc++.so.6.0.21

 

GCC5.4安装

标签:

原文地址:http://www.cnblogs.com/wkccs/p/5663972.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!