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 wit开发者_JAVA技巧h GCC4.4.4.
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:
#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.
精彩评论