C++ - Fedora 12 上的 GCC4.4.4 上缺少 stl_alloc.h?

发布于 2024-09-14 10:42:48 字数 174 浏览 22 评论 0原文

我正在移植应用程序 从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

渔村楼浪 2024-09-21 10:42:48

您的错误消息表明位目录中的文件丢失。为此可能导致两种可能的方式:

  1. 您从应用程序中明确包含此文件。那是你的错,因为它不是标准标头,并且它可能不在你的标准包含路径中。你应该避免这样做。与操作系统交互的大多数必要机制都在标准库中(或在其他专门为可移植性而设计的库中),因此您拥有比使用特定 STL 实现的位更好的解决方案。

  2. 该文件是从 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:

  1. 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.

  2. 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:

    #ifdef __BSD__
    // BSD-specific include file
    #include <bits/stl_alloc.h>
    #elsif defined __LINUX__
    #include <bits/linux_alloc.h>
    #endif
    

    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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文