/usr/include 文件(例如 string.h)与 gcc 版本有何关系?
我有一个带有 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 文档,但他们没有提到任何有关包含文件/目录的内容。
我在这里做错了什么?
I have a Kubuntu 11.10 system with Eclipse-CDT Indigo. gcc-4.6 was installed along with Eclipse. I have since installed gcc-4.4 and gcc-4.2 via Ubuntu packages.
I can switch the /usr/bin/gcc symlink to 4.4 or 4.6 and Eclipse builds my code either way. However when I set the symlink to use gcc-4.2 I get the following error (and many more):
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
So it appears that the string.h I have in /usr/include expects __BEGIN_DECLS to be defined by one of the compiler specific includes.
/usr/include/string.h comes from the libc6-dev package, which does not seem to have compiler specific versions. I expected the package system to handle this and install all the right versions of things.
I've read the GNU documents on multiple versions of GCC, but they don't say anything about include files/directories.
What am I doing wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的 gcc-4.2 软件包来自哪个 Ubuntu?
它可能来自较旧的 Ubuntu 版本。新的 Ubuntu 版本更改了一些标头和库目录,这会破坏旧的编译器。
From which Ubuntu is your gcc-4.2 package?
It is probably from an older Ubuntu release. New Ubuntu releases have changed some header and library directories, which break older compilers.