< stdatomic.h>在GCC 4.8?
我想使用由C11标准提供了新的原子操作。然而,试图的#include
相应的头文件给了我这样的:
I'd like to make use of the new atomic operations provided by the C11 standard. However, trying to #include
the appropriate header file gives me this:
csort-par.c:5:23: fatal error: stdatomic.h: No such file or directory
#include <stdatomic.h>
在 http://gcc.gnu.org/wiki/C11Status 文档似乎说这个头文件已经提供自GCC 4.7 ...我失去的东西吗? __ __ STDC_NO_ATOMICS
没有定义。
The documentation at http://gcc.gnu.org/wiki/C11Status seems to say that the header file has been provided since GCC 4.7... am I missing something? __STDC_NO_ATOMICS__
is not defined.
的gcc --version
如下:
gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
和我确认了 __ __ STDC_NO_ATOMICS
如下没有定义的:
And I confirmed that __STDC_NO_ATOMICS__
was not defined as follows:
#ifdef __STDC_NO_ATOMICS__
#error yes
#else
#error no
#endif
收益率:
csort-par.c:10:2: error: #error no
#error no
编辑:谢谢你的回复迅速
Thanks for the swift replies.
在任何情况下,在此跌倒从谷歌同样的问题,这里的临时修复,直到他们释放GCC 4.9:
In case anyone stumbles on this from Google with the same question, here's a fix in the interim until they release GCC 4.9:
此文件丢失。 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58016
这是固定只在GCC 4.9,因为它的发布说明称( http://gcc.gnu.org /gcc-4.9/changes.html )
It was fixed only in gcc 4.9, as its release notes says (http://gcc.gnu.org/gcc-4.9/changes.html)