C++0x mutex don't compile on minGW
Jonathan Wakely
jwakely.gcc@gmail.com
Mon Feb 14 17:38:00 GMT 2011
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.
More information about the Libstdc++
mailing list