Reputation: 3196
Program:
#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;
^~~
GCC info:
$ 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)
Using other parts of STL work just fine, it is only thread
that fails. Am I
missing something? When configured, GCC picks up the threading model.
Edit 1
Recompiled GCC with --enable-threads
. Still produces same error.
Edit 2
Recompiled GCC with --enable-libstdcxx-threads
. Still produces same error.
Edit 3
Recompiled GCC with --enable-threads=posix
. Still produces same error.
Edit 4
Wanted to make clear that I was building using the repo on branch gcc-6_2_0-release
.
Upvotes: 1
Views: 1053
Reputation: 3196
After trying multiple times to build using the repo source, I eventually gave up, and compiled using the released tarballs from a GNU mirror. Not sure what options would have made the difference from what is in the repo vs what is released, but I simply used:
--enable-languages=c,c++ --disable-multilib
and everything worked as expected.
Upvotes: 2