Attempting to use the boost library to create a system wide mutex from the docs
#include <boost/interprocess/sync/interprocess_mutex.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <boost/interprocess/sync/named_mutex.hpp>
using namespace boost::interprocess;
MutexType mtx;
int main()
{
return 0;
}
I am running visual studio code and compiling my code using msys2-MINGW64 environment like so g++ mutexes.cpp -lboost_system but this does not seem to work and I am getting this error in the bash console
mutexes.cpp:8:1: error: 'MutexType' does not name a type
8 | MutexType mtx;
| ^~~~~~~~~
The linked documentation specifically means "any mutex type":
It follows it up with a concrete, more elaborate Anonymous mutex example and Named mutex example.
Which types are eligible is documented at
scoped_lock:In practice the minimal useful interface required will be that of the standard library
BasicLockableconcept although many mutex implementations also modelLockableandMutexconcepts.