0

我有一个带有 Eclipse-CDT Indigo 的 Kubuntu 11.10 系统。gcc-4.6 与 Eclipse 一起安装。我已经通过 Ubuntu 软件包安装了 gcc-4.4 和 gcc-4.2。

我可以将 /usr/bin/gcc 符号链接切换到 4.4 或 4.6,Eclipse 以任何一种方式构建我的代码。但是,当我将符号链接设置为使用 gcc-4.2 时,出现以下错误(以及更多错误):

In file included from /usr/include/c++/4.2/cstring:52,
             from /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h:47,
             from /usr/include/c++/4.2/iosfwd:45,
             from /usr/include/c++/4.2/ios:43,
             from /usr/include/c++/4.2/ostream:45,
             from /usr/include/c++/4.2/iostream:45,
             from ../ProjStructure.h:4,
             from ../Scanner.h:3,
             from ../Scanner.cpp:1:
/usr/include/string.h:29: error: ‘__BEGIN_DECLS’ does not name a type

因此,我在 /usr/include 中的 string.h 似乎期望 __BEGIN_DECLS 由编译器特定包含之一定义。

/usr/include/string.h 来自 libc6-dev 包,它似乎没有编译器特定的版本。我希望包系统能够处理这个问题并安装所有正确版本的东西。

我已经阅读了多个版本的 GCC 的 GNU 文档,但他们没有说任何关于包含文件/目录的内容。

我在这里做错了什么?

4

1 回答 1

2

您的 gcc-4.2 软件包来自哪个 Ubuntu?

它可能来自较旧的 Ubuntu 版本。新的 Ubuntu 版本更改了一些头文件和库目录,这会破坏旧的编译器。

于 2011-11-11T20:43:31.470 回答