参考http://blog.youkuaiyun.com/cssmhyl/article/details/8114386编译4.7.2,对原作者表示感谢。
使用g++4.7.2熟悉c++11,遇到下面问题。。
'thread' isnotamemberof 'std
'yield' is not a member of 'std::this_thread'
sleep_for’ is not a member of ‘std::this_thread’
原因是编译时缺少选项所致,导致一些宏未产生在诸如c++config.h这样的文件中,编译出来的gcc有些新的命名空间对象对外隐藏了。

在尝试使用g++4.7.2和C++11标准时遇到'thread'、'yield'、'sleep_for'等不是std命名空间成员的问题。解决办法是重新编译GCC,添加特定选项如--enable-languages、--enable-libstdcxx-time等以启用C++11新特性。完成编译后,通过-g++ -std=c++11进行C++11代码编译。
最低0.47元/天 解锁文章
6万+

被折叠的 条评论
为什么被折叠?



