简体   繁体   English

<stdatomic.h>在GCC 4.8?

[英]<stdatomic.h> in GCC 4.8?

I'd like to make use of the new atomic operations provided by the C11 standard. 我想利用C11标准提供的新原子操作。 However, trying to #include the appropriate header file gives me this: 但是,尝试#include适当的头文件给了我这个:

 csort-par.c:5:23: fatal error: stdatomic.h: No such file or directory
 #include <stdatomic.h>

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? http://gcc.gnu.org/wiki/C11Status上的文档似乎说自从GCC 4.7以来提供了头文件...我错过了什么? __STDC_NO_ATOMICS__ is not defined. __STDC_NO_ATOMICS__未定义。

gcc --version is as follows: gcc --version如下:

gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.

And I confirmed that __STDC_NO_ATOMICS__ was not defined as follows: 我确认__STDC_NO_ATOMICS__没有定义如下:

#ifdef __STDC_NO_ATOMICS__
#error yes
#else
#error no
#endif

yields: 收益率:

csort-par.c:10:2: error: #error no
 #error no

EDIT: Thanks for the swift replies. 编辑:感谢您的快速回复。

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: 如果有人在谷歌遇到同样的问题而绊倒了这个问题,那么在此期间需要修复,直到他们发布GCC 4.9:

UNIX Portable Atomic Operations UNIX便携式原子操作

This file is missing. 此文件丢失。 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58016 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58016

It was fixed only in gcc 4.9, as its release notes says ( http://gcc.gnu.org/gcc-4.9/changes.html ) 它仅在gcc 4.9中修复,正如其发行说明所述( http://gcc.gnu.org/gcc-4.9/changes.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 C11 GCC 使数据读/写原子化<stdatomic.h> ? - Making data reads/writes atomic in C11 GCC using <stdatomic.h>? Xcode和C11 stdatomic.h - Xcode and C11 stdatomic.h 如何在缺少stdatomic.h的机器上使用原子整数? - How to have atomic integers on machines that lack stdatomic.h? stdatomic.h function 在普通 int 上 - 产生未定义或实现定义的行为? - stdatomic.h function on plain int - yields undefined or implementation defined behaviour? stdatomic.h 的名称是否与在句点之前映射到八个有效字符的(潜在)限制相矛盾? - Does name of stdatomic.h contradict with (potential) restriction of the mapping to eight significant characters before the period? 可用的编译器是否提供C11'_Atomic'关键字及其相关标题'stdatomic.h'的实现? - Does an available compiler provide an implementation of the C11 '_Atomic' keyword and its related header 'stdatomic.h'? 做atomic_store /加载 <stdatomic.h> 适用于英特尔的未对齐,跨缓存行数据? - Do atomic_store/load from <stdatomic.h> work for unaligned, cross-cache-line data on Intel? 我可以在Linux驱动程序中使用C11中的<stdatomic.h>,还是必须使用内存屏障的Linux功能? - Can I use <stdatomic.h> from C11 in Linux driver, or do I must to use Linux functions of memory-barriers? 为什么 stdatomic.h 包含 atomic_uint_least16_t 和 atomic_uint_fast16_t 但不包含 atomic_uint16_t? - Why does stdatomic.h contain atomic_uint_least16_t and atomic_uint_fast16_t but not atomic_uint16_t? 与libmagic链接时,GCC 4.8失败 - GCC 4.8 fails while linking with libmagic
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM