Skip to main content
Burninating the [deleted] tag - yum!
Source Link
Unihedron
  • 11.1k
  • 13
  • 65
  • 72

I have class looks as follows in .h.h file (Header)

#include <boost/thread.hpp> class MyClass{ private: boost::mutex bPoolMtx_; // ... other vars public: // public vars and methods   } 

I get the following error trying to build/ compile.

MyClass.h:38:7: note: ‘MyClass::MyClass(const MyClass&)’ is implicitly deleted because the default definition would be ill-formed: MyClass.h:38:7: error: use of deleted function ‘boost::mutex::mutex(const boost::mutex&)’ 

I don't use the mutex at all in the cpp file yet. When I comment out the boost::mutexboost::mutex line it builds fine. What is going on?

I have class looks as follows in .h file (Header)

#include <boost/thread.hpp> class MyClass{ private: boost::mutex bPoolMtx_; // ... other vars public: // public vars and methods   } 

I get the following error trying to build/ compile.

MyClass.h:38:7: note: ‘MyClass::MyClass(const MyClass&)’ is implicitly deleted because the default definition would be ill-formed: MyClass.h:38:7: error: use of deleted function ‘boost::mutex::mutex(const boost::mutex&)’ 

I don't use the mutex at all in the cpp file yet. When I comment out the boost::mutex line it builds fine. What is going on?

I have class looks as follows in .h file (Header)

#include <boost/thread.hpp> class MyClass{ private: boost::mutex bPoolMtx_; // ... other vars public: // public vars and methods } 

I get the following error trying to build/ compile.

MyClass.h:38:7: note: ‘MyClass::MyClass(const MyClass&)’ is implicitly deleted because the default definition would be ill-formed: MyClass.h:38:7: error: use of deleted function ‘boost::mutex::mutex(const boost::mutex&)’ 

I don't use the mutex at all in the cpp file yet. When I comment out the boost::mutex line it builds fine. What is going on?

Source Link
Saher Ahwal
  • 9.3k
  • 33
  • 91
  • 156

Using boost::mutex - implicitly deleted error (because the default definition would be ill-formed)

I have class looks as follows in .h file (Header)

#include <boost/thread.hpp> class MyClass{ private: boost::mutex bPoolMtx_; // ... other vars public: // public vars and methods } 

I get the following error trying to build/ compile.

MyClass.h:38:7: note: ‘MyClass::MyClass(const MyClass&)’ is implicitly deleted because the default definition would be ill-formed: MyClass.h:38:7: error: use of deleted function ‘boost::mutex::mutex(const boost::mutex&)’ 

I don't use the mutex at all in the cpp file yet. When I comment out the boost::mutex line it builds fine. What is going on?