Getting error: "mutex" in namespace "std" does not indicate type at MinGW mysys prompt

I downloaded MinGW from the official site and installed it on my Windows 8.1 machine.

Running g ++ --version gives me g ++. exe (GCC) 4.8.1.

I am trying to compile an existing code base in the MinGW compiler, but it does not work with the following error:

error: 'mutex' in namespace 'std' does not name a type private: std::mutex m_Mutex; ^ error: 'condition_variable' in namespace 's 

and many more blocking and threading errors.!

I was able to compile the same code base in Cygwin-64 without any problems. I need to compile and compile in MinGW to create some DLL files that will be compatible with MSVS.

I already referenced the following links, but I could not solve the problem.

Getting std :: thread / mutex to work under Win7 with mingw and g ++ 4.7.2
MinGW 4.8.1 C ++ 11 Stream Support

Your help will be greatly appreciated. Thanks.

+6
source share
1 answer

The old MinGW from mingw.org does not support C ++ 11 streaming facilities.

A direct alternative would be to use MSYS2 and install MinGW-w64 compilers there that support the required functionality. Follow the instructions in this document and follow these steps:

 pacman -Sy mingw-w64-i686-gcc 

What will give you 32-bit GCC MinGW-w64. You can call it from the 32-bit MinGW-w64 shell or add <MSYS2>\mingw32\bin to PATH.

+7
source

Source: https://habr.com/ru/post/980975/


All Articles