This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: C++0x mutex don't compile on minGW
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Claudio La Rosa <clros at tiscali dot it>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Mon, 14 Feb 2011 17:37:56 +0000
- Subject: Re: C++0x mutex don't compile on minGW
- References: <30923238.post@talk.nabble.com>
On 14 February 2011 16:19, Claudio La Rosa wrote:
>
> Hi,
> I have this code:
>
>
> #include <thread>
>
> using namespace std;
>
> class TryMutex
> {
> ? ?public:
> ? ? ? ?TryMutex();
> ? ? ? ?virtual ~TryMutex();
> ? ?protected:
> ? ?private:
> ? ?mutex myMutex;
> };
>
>
> myMutex is an instance of std::mutex, a new C++0x class for multithreading.
>
> This code compiles fine on Linux with GCC/G++ 4.5.1, but under Window with
> minGW (GCC/G++) 4.5.2 I have this error on compiling:
>
> error: 'mutex' does not name a type
>
> Why?
The <mutex> header has the following condition:
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
Presumably one or both of those macros is undefined for your MinGW build.