我构建了 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 测试信息:
/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