C11< thread.h>在GCC? [英] C11 <thread.h> in GCC?

查看:85
本文介绍了C11< thread.h>在GCC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译使用 thread.h 部分C11 code,但我不能。我已经重新编译海湾合作委员会(现在的运行4.6.2),我试图用的gcc -std = C1X file.c中-o文件进行编译。我可以在G ++做到这一点(使用线程库,这是),但我不能在C是 thread.h 不在GCC分布尚未纳入?

I’m trying to compile some C11 code using thread.h, but I can’t. I've recompiled GCC (running 4.6.2 now), and I’m trying to compile with gcc -std=c1x file.c -o file. I can do this in g++ (using the thread library, that is) but I can’t in C. Is thread.h not included in the GCC distribution yet?

推荐答案

穿线标准C11标题是< threads.h> ,而不是< thread.h> 。请参阅 N1570 草案第7.26。

The standard C11 header for threading is <threads.h>, not <thread.h>. See section 7.26 of the N1570 draft.

大多数C标准库,包括STDIO例如,不包括在gcc的分布。相反,GCC取决于任何运行时库是由操作系统提供的。这通常包括标题(如&LT; threads.h&GT; )和实际code实现库

Most of the C standard library, including stdio for example, is not included in the gcc distribution. Instead, gcc depends on whatever runtime library is provided by the operating system. That generally includes both the headers (like <threads.h>) and the actual code that implements the library.

对于大多数Linux系统(或GNU / Linux的,如果你preFER),该库是GNU的glibc的;对于其它系统,这将是别的东西。

For most Linux systems (or GNU/Linux if you prefer), the library is GNU's glibc; for other systems it will be something else.

因此​​,真正的问题可能是,当你使用的glibc,或任何C库,将支持C11的线程功能。

So the real question is probably when glibc, or whichever C library you're using, will support C11's threading features.

(注意,库的几个部分,那些最密切相关的编译器,的是由GCC本身提供的的该线程库的可能的是不是一个他们,但肯定有的编译器的支持是必需的。)

(Note that a few parts of the library, those most closely tied to the compiler, are provided by gcc itself. The threading library probably isn't one of them, but certainly some compiler support is required.)

这篇关于C11&LT; thread.h&GT;在GCC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆