MinGW 5.3.0中的'mutex'不是'std'的成员

Ami*_*sai 5 c++ mutex mingw crypto++ c++11

我正在使用MinGW 5.3.0和Crypto ++ 5.6.5:

C:\MinGW>g++ -std=c++11 -s -D_WIN32_WINNT=0x0501 LOG.cpp -U__STRICT_ANSI__ Decclass.cpp \
-IC:\\MinGW\\ -IC:\\MinGW\\boost -LC:\\MinGW  -lssl -lcrypto -lcryptopp -lgdi32 -lPCRYPT \
 -lz -ltiny -lwsock32 -lws2_32 -lShlwapi
Run Code Online (Sandbox Code Playgroud)

编译会导致以下错误。

c:\mingw\cryptopp565\include\cryptopp\misc.h:287:14: error: 'mutex' in namespace 'std'
does not name a typestatic std::mutex s_mutex;

c:\mingw\cryptopp565\include\cryptopp\misc.h:296:18: error: 'mutex' is not a member of
'std'std::lock_guard<std::mutex> lock(s_mutex);
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

它显示“ mutex”不是“ std”的成员

我需要其他版本的MinGW吗?还是我可以自己修复此版本?

Ami*_*sai 3

我通过编辑路径“cryptopp565\include\cryptopp\misc.h”中的“ misc.h”来解决此问题

在Misc.h的顶部,我包含了boost 库中的mutex.hpp

#include "c:\mingw\include\boost\asio\detail\mutex.hpp"
Run Code Online (Sandbox Code Playgroud)

我也将命名空间从std更改为boost::asio::detail

static std::mutex s_mutex; 
static boost::asio::detail::mutex s_mutex;
Run Code Online (Sandbox Code Playgroud)