gpt4 book ai didi

未找到 C11 GCC threads.h?

转载 作者:太空宇宙 更新时间:2023-11-04 04:21:58 25 4
gpt4 key购买 nike

下面的代码

#include <threads.h>

给我这个错误:

fatal error: threads.h: No such file or directory

使用最新的 GCC 和 Clang 以及 -std=c11。

GCC 和 Clang 不支持 C11 线程吗?或者是否有黑客(或安装的东西)来获得它?我只是将 Ubuntu 14.04 与 Ubuntu 存储库中的 gcc 和 clang 软件包一起使用。

最佳答案

gcc 文件 C11 status表明它不支持线程,它说:

Threading [Optional] | Library issue (not implemented)

正如文档所指出的,这实际上不是 gccclang 问题,而是 glibc 问题。正如扎克指出的那样,它看起来像 there may be work under way soonglibc 中获得对此的支持,但现在这对您没有帮助。您可以使用 this与此同时。

已为 glibc 2.28 修复

根据Bug 14092 - Support C11 threads这在 glibc 2.28 中已修复:

Implemented upstream by:

9d0a979 Add manual documentation for threads.h
0a07288 nptl: Add test cases for ISO C11 threads
c6dd669 nptl: Add abilist symbols for C11 threads
78d4013 nptl: Add C11 threads tss_* functions
918311a nptl: Add C11 threads cnd_* functions
3c20a67 nptl: Add C11 threads call_once functions
18d59c1 nptl: Add C11 threads mtx_* functions
ce7528f nptl: Add C11 threads thrd_* functions

It will be included in 2.28.

关于未找到 C11 GCC threads.h?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45977756/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com