更改版本后降级g ++

时间:2014-04-25 14:46:12

标签: c++ c gcc c++11 lambda

所以以前我尝试用c ++编译一个lambda表达式,我的默认编译器是gcc-4.4,你知道它不支持lambda表达式,所以我试着安装一个更新版本的gcc-4.7,安装成功,但在那之后,我无法编译我的任何程序。

我试图恢复以前版本的gcc,但更新替代品并不适合我。

-errors:

    In file included from /usr/local/include/htmlcxx/html/ParserDom.h:5:0,
             from urlServer.cpp:7:
    /usr/local/include/htmlcxx/html/tree.h:118:21: error: ‘ptrdiff_t’ does not name a type
    urlServer.cpp: In lambda function:
    urlServer.cpp:148:29: error: ‘urlHash’ is not captured
    urlServer.cpp:148:38: error: return-statement with a value, in function returning            'void' [-fpermissive]
    In file included from /usr/local/lib/gcc/i686-pc-linux-         gnu/4.7.1/../../../../include/c++/4.7.1/algorithm:63:0,
               from urlServer.cpp:5:
     /usr/local/lib/gcc/i686-pc-linux- gnu/4.7.1/../../../../include/c++/4.7.1/bits/stl_algo.h: In instantiation of  ‘_InputIterator std::__find_if(_InputIterator, _InputIterator, _Predicate,           std::input_iterator_tag) [with _InputIterator =   std::istream_iterator<std::basic_string<char> >; _Predicate =     writeAllLinks(std::list<std::basic_string<char> >)::<lambda(const string&)>]’:
     /usr/local/lib/gcc/i686-pc-linux-    gnu/4.7.1/../../../../include/c++/4.7.1/bits/stl_algo.h:4490:41:   required from ‘_IIter       std::find_if(_IIter, _IIter, _Predicate) [with _IIter =   std::istream_iterator<std::basic_string<char> >; _Predicate =        writeAllLinks(std::list<std::basic_string<char> >)::<lambda(const string&)>]’
     urlServer.cpp:148:39:   required from here
     usr/local/lib/gcc/i686-pc-linux- gnu/4.7.1/../../../../include/c++/4.7.1/bits/stl_algo.h:146:7: error: void value not   ignored as it ought to be

我正在使用debian

问题:如何恢复以前版本的gcc?

我知道这个问题已经被问到但是我找不到答案,我尽我所能,谢谢;

1 个答案:

答案 0 :(得分:1)

1)只需使用Linux发行版的软件包管理器再次安装软件包即可。您的工具中还应该有类似修复包或其他类似选项的内容。别忘了你需要一个有效的binutils / gcc / libc / g ++ / libg ++组合。也许您的发行版包含一个用于开发的元数据包,其中包含所有需要的包。

2)您可以并行安装多个版本的编译器。 您只需要为配置选项提供--prefix =。我用 /opt/linux-gnu-gcc4.x.x用于版本。使用/ opt路径是不常与您的发行版包冲突的常见做法。

3)问题是,根本无法编译任何程序,这不是一个很好的问题描述。对我来说,听起来你有一组混合的库头到不兼容的头问题。没有更详细的错误描述,没有人能够理解你做了什么。但你应该从1)

开始
相关问题