__USE_XOPEN2K8的用途以及如何设置? [英] Purpose of __USE_XOPEN2K8 and how to set it?
问题描述
我试图编译gtk堆栈(最后一个gtk2版本,2.24),并且我收到了一堆看起来相关的错误。也就是说,不能从string.h和time.h中找到 __ locale_t
,并且 LC_ALL_MASK
不能是(应该在locale.h中)。
我发现所有这些问题都与 __ USE_XOPEN2K8
不被#defined。什么是 __ USE_XOPEN2K8
for,以及如何设置它propertyly?
例如,我必须通过标志为./configure为glib,gtk,...还是在构建gcc或glib c 时必须更改某些内容?我宁愿不要将 #define __USE_XOPEN2K8
放入源中,而不知道它的作用。注意我使用安装在非标准前缀中的gcc-4.6.3和glibc-2.16.0,因为我试图让gtk库在只包含旧版本的旧版CentOS(5.8)上工作。 / p>
还要注意在几个地方提及缺少 编辑:我找到了这个线程描述问题。显然,主机系统的头文件会被fixincluded到新编译器的头文件中。链接的帖子建议编辑features.h。有谁知道我是否必须事后重新编译gcc / glibc(以及如何让它获取新的features.h,而不是覆盖它)? 或者,您可以尝试通过 I'm trying to compile the gtk stack (the last gtk2 version, 2.24), and I am getting a bunch of errors that seem related. Namely, the I found that all of these problems are related to For example, do I have to pass a flag to ./configure for glib, gtk, ... or do I have to change something already while building gcc or glibc̲? I'd rather not just sprinkle Also note the missing Edit: I've found this thread describing the problem. Apparently, headers of the host system get "fixincluded" into the headers of the new compiler. The linked post suggests to edit features.h. Does anyone know if I have to recompile gcc / glibc afterwards (and how to get it to pick up the new features.h, rather than overwriting it)? When Alternatively, you can try specifying GNU extension usage to gcc through the 这篇关于__USE_XOPEN2K8的用途以及如何设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! __ locale_t
,例如此bugreport 。我可以在一些文件中添加 #include< xlocale.h>
,但似乎正确的解决方案是获得 __ USE_XOPEN2K8 $ c
__ USE_GNU
被定义时, __ USE_XOPEN2K8
总是被定义的,除非你
明确定义或取消定义这些宏,您不能这样做。
在包含
之前使用 _GNU_SOURCE
, _XOPEN_SOURCE {500,600,700,...}
第一个标题。这是在glibc头文件中选择GNU功能集并在命令行中定义它的建议方法( -D_GNU_SOURCE
)。
-std
命令行开关( gnu89 $ c $>)将gcc的GNU扩展用法指定给gcc c>,
gnu99
等等)。__locale_t
can't be found from string.h and time.h, and LC_ALL_MASK
can't be found either (should be in locale.h).__USE_XOPEN2K8
not being #defined. What is __USE_XOPEN2K8
for, and how can I set it propertly?#define __USE_XOPEN2K8
in to my sources without knowing what it does. Note I'm using gcc-4.6.3 and glibc-2.16.0 which are installed in a nonstandard prefix, as I'm trying to get the gtk libraries to work on an older CentOS (5.8) that only includes older versions.__locale_t
is mentioned in several places, e.g. this bugreport. I could just add #include <xlocale.h>
in some files, but it seems the proper solution would be to get __USE_XOPEN2K8
to be set.
__USE_GNU
is defined, __USE_XOPEN2K8
is always defined as well, unless you
are explicitly defining or undefining these macros, which you must not do.
Use _GNU_SOURCE
, _XOPEN_SOURCE {500,600,700,...}
etc. macros before including
the first header instead. This is the recommended way to select the GNU feature set in glibc headers, together with defining it on the command line (-D_GNU_SOURCE
).-std
command line switch (gnu89
, gnu99
, and so forth).