我构建了gcc 4.8.1和libstdc ++。so.6.0.18,软链接libstdc ++。so.6.0.18到libstdc ++。so.6 我检查了g ++ -v,它是4.8.1
test.cpp:11:9: error: ‘thread’ is not a member of ‘std’
std::thread t(hello);
但即使是单行也不能编译..
如何解决?
总代码:
#include <iostream>
#include <thread>
void hello()
{
std::cout<<"Hello Concurrent World\n";
}
int main(int argc, char * argv[])
{
std::thread t(hello);
t.join();
return 0;
}
g ++ -H -std = c ++ 11 test.cpp -o test info:
/usr/include/asm/errno.h
/usr/include/bits/byteswap.h
/usr/include/bits/endian.h
/usr/include/bits/errno.h
/usr/include/bits/locale.h
/usr/include/bits/sched.h
/usr/include/bits/select.h
/usr/include/bits/sigset.h
/usr/include/bits/stdio_lim.h
/usr/include/bits/sys_errlist.h
/usr/include/bits/typesizes.h
/usr/include/bits/waitflags.h
/usr/include/bits/waitstatus.h
/usr/include/errno.h
/usr/include/gnu/stubs-64.h
/usr/include/gnu/stubs.h
/usr/local/include/c++/4.8.1/bits/ctype_base.h
/usr/local/include/c++/4.8.1/bits/ctype_inline.h
/usr/local/include/c++/4.8.1/cerrno
/usr/local/include/c++/4.8.1/clocale
/usr/local/include/c++/4.8.1/cstdio
/usr/local/include/c++/4.8.1/cstdlib
/usr/local/include/c++/4.8.1/ctime
/usr/local/include/c++/4.8.1/cwctype