3

Hello I am trying to compile one of my C++ projects. But while compiling one of the headers shows 9 errors. Well I dont know how my project is related to handling mutexes. I am using Visual Studio Code. I shall attach the code and errors. Please guide with how to rectify these errors.

  //
  // Copyright (C) 2011-2017 Denis V Chapligin, Martin Hrabovsky
  // Distributed under the Boost Software License, Version 1.0.
  // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 //

  //
 // Copyright (C) 2011 Denis V Chapligin
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 //

 #ifndef STLCACHE_LOCK_EXCLUSIVE_HPP_INCLUDED
 #define STLCACHE_LOCK_EXCLUSIVE_HPP_INCLUDED

 #include <mutex>
 #include<thread>
 using namespace std;

 namespace stlcache {
/*!
 * \brief An exclusive only implementation of locking.
 * 
 * This implementation supports only mutually exclusive locking, so only a 
 single thread at a time can access the \link stlcache::cache cache \endlink
 */

class lock_exclusive : public lock<unique_lock<mutex>, unique_lock<mutex> > {
      mutable mutex mtx;
public:
    write lockWrite() const { 
        return unique_lock<mutex>(mtx); 
    }

    read lockRead() const { 
        return unique_lock<mutex>(mtx);
    }
};
}

#endif /* STLCACHE_LOCK_EXCLUSIVE_HPP_INCLUDED */

errors:
'mutex' was not declared in this scope
template argument 1 is invalid
'mutex' was not declared in this scope
template argument 1 is invalid
template argument 1 is invalid
template argument 2 is invalid
'mutex' does not name a type
'write' does not name a type
'read' does not name a type
  • Possible duplicate of [Does MinGW-w64 support std::thread out of the box when using the Win32 threading model?](https://stackoverflow.com/questions/37358856/does-mingw-w64-support-stdthread-out-of-the-box-when-using-the-win32-threading) – Tyker Jun 29 '18 at 09:29

0 Answers0