MinGW 5.3.0中的'mutex'不是'std'的成员 [英] 'mutex' is not a member of 'std' in MinGW 5.3.0
本文介绍了MinGW 5.3.0中的'mutex'不是'std'的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用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
编译会导致以下错误.
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);
显示'mutex'不是'std'的成员
我需要其他版本的MinGW吗? 还是我可以自行修复此版本?
解决方案
我通过在路径"cryptopp565 \ include \ cryptopp \ misc.h"中编辑"misc.h" 来解决此问题. /p>
在 misc.h 的顶部,我包含了 boost库
中的 mutex.hpp#include "c:\mingw\include\boost\asio\detail\mutex.hpp"
并且我还将命名空间也从 std 更改为 boost :: asio :: detail
static std::mutex s_mutex;
static boost::asio::detail::mutex s_mutex;
I am using MinGW 5.3.0 and 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
Compiling results in the error below.
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);
It showing 'mutex' is not a member of 'std'
Do i need anther version of MinGW ? Or can I fix this build itself?
解决方案
I fix this issue by editing "misc.h" in the path "cryptopp565\include\cryptopp\misc.h"
On the top of misc.h I included the mutex.hpp from boost library
#include "c:\mingw\include\boost\asio\detail\mutex.hpp"
and i changed namespace also from std to boost::asio::detail
static std::mutex s_mutex;
static boost::asio::detail::mutex s_mutex;
这篇关于MinGW 5.3.0中的'mutex'不是'std'的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文