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 supports std::thread and std::mutex with POSIX threads only, definitely a gap of the non-POSIX-release.
Now, you do not switch your development environment for a single program.
Options are to build stubs from POSIX specific templates (those code branches selected by _GLIBCXX_HAS_GTHREADS) or MS-Sources or BOOST library ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With