Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

incomplete type error on using boost::enable_shared_from_this

Tags:

c++

shared-ptr

At the following line

class Symbol : public boost::enable_shared_from_this<Symbol> {

I get the error:

error: invalid use of incomplete type struct boost::enable_shared_from_this<Symbol> /usr/include/boost/smart_ptr/shared_ptr.hpp:63: error: declaration of struct boost::enable_shared_from_this<Symbol>

Any idea why am I getting this error. Symbol is an abstract class(if that matters)

like image 956
Abhishek Anand Avatar asked May 09 '12 04:05

Abhishek Anand


1 Answers

Opps. The error was because I did not include the header which defines enable_shared_from_this (which is boost/enable_shared_from_this.hpp) .

It was only declared in /usr/include/boost/smart_ptr/shared_ptr.hpp

like image 86
Abhishek Anand Avatar answered Oct 05 '22 03:10

Abhishek Anand