C++ - Fedora 12 上的 GCC4.4.4 上缺少 stl_alloc.h?
我正在移植应用程序 从 BSD 平台到 Linux 机器。编译时,我发现某些头文件调用了
,而我的计算机上缺少该头文件。有谁知道我在哪里可以找到这个和/或为什么它丢失了?
我正在运行带有 GCC4.4.4 的 Fedora 12 机器。
I am in the process of porting an application
from a BSD platform onto a Linux box. When compiling, I have found that some of the header files call for <bits/stl_alloc.h>
, which is missing from my computer. Does anyone have any idea as to where I can find this and/or why it is missing?
I am running a Fedora 12 machine with GCC4.4.4.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的错误消息表明位目录中的文件丢失。为此可能导致两种可能的方式:
您从应用程序中明确包含此文件。那是你的错,因为它不是标准标头,并且它可能不在你的标准包含路径中。你应该避免这样做。与操作系统交互的大多数必要机制都在标准库中(或在其他专门为可移植性而设计的库中),因此您拥有比使用特定 STL 实现的位更好的解决方案。
该文件是从 STL 的一些标准头文件中间接包含的。问题是 Fedora 上的 STL 实现可以是可移植的,并且可以有一些 BSD 支持。它的标头中可能包含以下代码:
<前><代码>#ifdef __BSD__;
// BSD 特定的包含文件
#include
#elsif 定义了 __LINUX__
#include
#endif
通常,在 Linux 上开发的程序会包含正确的文件。但是,您的程序可能已经自行定义了 BSD 指纹,并且该指纹可能会被 STL 实现误解,因为它应该包含其 BSD 特定部分。如果您仅在 BSD 上构建它,您根本不会注意到它。
Your error message shows that a file from bits directory is missing. To this could lead two possible ways:
You included this file explicitly from your application. That's your fault then, since it's not a standard header, and it may not be in your standard include path. You should avoid doing this. Most of the necessary mechanisms of interacting with the OS are in standard library (or in other ones specifically designed for portability), so you have better solutions than using bits of a particular STL implementation.
This file is included indirectly from some of the standard headers of STL. The thing is that STL implementation on Fedora could be portable, and could have some BSD support. It could have the following code in its headers:
Normally, a program developed on Linux would include the correct file. However, your program might have defined BSD fingerprint on its own, and this fingerprint could be misinterpreted by STL implementation as that it should include its BSD-specific parts. And if you built it on BSD only, you owuldn't have noticed it at all.