GCC std :: thread在命名空间std中找不到 [英] GCC std::thread not found in namespace std

查看:2047
本文介绍了GCC std :: thread在命名空间std中找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用GCC 4.5.0与Eclipse IDE(如果这很重要)在Windows上通过MinGW。



我使用 -std = c ++ 0x 标志。



我发现 _GLIBCXX_HAS_GTHREADS 因为线程对我来说还不是命名空间 std 的成员。



用GCC获得C ++ 11线程支持是什么?



p PS它不识别 -pthread 标志。我在这个网站的其他地方读到这个问题。



编辑:stupid me: pthread ,不是一个选项。

解决方案

在Linux上可以正常运行( g ++ -std = c ++ 0x -lpthread ,没有其他定义)。



但是, Cygwin邮件列表上的此线程建议,至少在4.4版本中,_GLIBCXX_HAS_GTHREADS在构建libstdc ++时被autoconf测试禁用,因为cygwin的pthread实现缺少pthread_mutex_timedlock。也许MinGW也有同样的问题。



此外,这个线程在comp.lang.c ++。moderated 说同样的事情。图书馆不支持。


I am using GCC 4.5.0 with the Eclipse IDE (if that matters) on Windows via MinGW.

I'm using the -std=c++0x flag.

I find that _GLIBCXX_HAS_GTHREADS still isn't defined, so thread for me still isn't a member of namespace std. -- or perhaps it is something else.

What does one do to get C++11 threading support with GCC?

P.S. It doesn't recognize the -pthread flag. I read in a question elsewhere on this site that this works.

Edit: Stupid me: pthread is a library, not an option. It's installed, gcc can find the header, but still no cigar.

解决方案

Works fine on Linux (g++ -std=c++0x -lpthread with no additional defines).

However, this thread on Cygwin mailing list suggests that, at least as of 4.4, _GLIBCXX_HAS_GTHREADS was disabled by an autoconf test when building libstdc++ because pthread implementation of cygwin is missing pthread_mutex_timedlock. Perhaps MinGW has the same problem.

Also, this thread on comp.lang.c++.moderated says the same thing. Not supported by the library.

这篇关于GCC std :: thread在命名空间std中找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆