This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++0x mutex don't compile on minGW


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]