Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Multithreading gcc 6.2.0螺纹不是std的成员_Multithreading_C++11_Gcc_Stl - Fatal编程技术网

Multithreading gcc 6.2.0螺纹不是std的成员

Multithreading gcc 6.2.0螺纹不是std的成员,multithreading,c++11,gcc,stl,Multithreading,C++11,Gcc,Stl,节目: #include <thread> int main(void) { std::thread t; return 0; } test.cpp: In function ‘int main()’: test.cpp:6:5: error: ‘thread’ is not a member of ‘std’ std::thread t; ^~~ $ g++ test.cpp -H . /home/nathan/development/tool

节目:

#include <thread>

int main(void)
{
    std::thread t;
    return 0;
}

test.cpp: In function ‘int main()’:
test.cpp:6:5: error: ‘thread’ is not a member of ‘std’
    std::thread t;
    ^~~
$ g++ test.cpp -H
. /home/nathan/development/toolchain/gnu/x86_64-unknown-linux-gnu/include/c++/6.2.0/thread

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/nathan/development/toolchain/gnu/x86_64-unknown-linux-gnu/libexec/gcc/x86_64-pc-linux-gnu/6.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/nathan/development/toolchain/gnu/x86_64-unknown-linux-gnu --enable-languages=c,c++,fortran --disable-multilib --enable-threads=posix --enable-libstdcxx-threads
Thread model: posix
gcc version 6.2.0 (GCC)
使用STL的其他部分可以很好地工作,只有
thread
失败。我是吗 遗漏了什么?配置后,GCC将选择线程模型

编辑1

使用
重新编译GCC——启用线程
。仍然会产生相同的错误

编辑2

使用
重新编译GCC——启用libstdcxx线程
。仍然会产生相同的错误

编辑3

使用
重新编译GCC——启用线程=posix
。仍然会产生相同的错误

编辑4


我想明确我是在分支上使用repo构建的
gcc-6_2_0-release

在多次尝试使用repo源代码构建之后,我最终放弃了,并使用GNU镜像中发布的tarball进行编译。不确定哪些选项会使回购协议中的内容与发行的内容有所不同,但我只是使用了:

<代码>——启用语言= C、C++——禁用多个LIB <代码> < /P>


<>和一切都是按预期运行的。

你可能已经建立了GCC而没有线程支持C++。尝试<代码> G++.exe -DM -E-X C++ + STD= C++ 11测试。CPP EEGRP'GLYBCXXXHASGGXYLY GLYBCXXUXY使用C99 OSITTIN TRO1。如果您没有看到这两个定义,那么您的构建就没有线程支持。不知道是否仍然需要启用线程。我只看到了定义、使用、C99、STDINT和TR1。我猜我是用
--启用线程
重建的。为什么这不是2016年的默认设置?@n.m.我刚刚用
--enable threads
完成了构建,但仍然得到相同的错误。我还遗漏了什么吗?不知道。Grep构建日志以获取关于线程的消息。它不应该是
--enable threads=posix
?我想这是在
gcc
配置文档中提到的:很高兴知道,我想我会注意始终使用发布tarballs。。。你可以试着看看他们是否有“发布gcc”的指令?可能确实有一些额外的准备步骤,比如从其他回购协议或其他东西复制代码。