2012-05-09 14 views
6

Al seguente rigaerrore di tipo incompleto sull'uso boost :: enable_shared_from_this

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

ottengo l'errore:

errore: Utilizzo non valido di tipo incompleto struct boost::enable_shared_from_this<Symbol> /usr/include/boost/smart_ptr/shared_ptr.hpp: 63: errore: dichiarazione di struct boost::enable_shared_from_this<Symbol>

Qualche idea sul perché ottengo questo errore. Symbol è una classe astratta (se quello che conta)

+0

voglio passare uno shared_ptr a 'this' a funzioni che accettano boost :: shared_ptr . Ho usato l'idea da http://stackoverflow.com/questions/712279/what-is-the-usefulness-of-enable-shared-from-this –

+1

@JerryCoffin: Er, è specificatamente * * progettato per essere una classe di base . –

+1

@CatPlusPlus: Oops: tutto a posto. Immagino che avrei dovuto guardarmi prima di saltare dentro ... –

risposta

10

Opps. L'errore è stato perché non ho incluso l'intestazione che definisce enable_shared_from_this (che è boost/enable_shared_from_this.hpp).

E 'stato dichiarato solo in /usr/include/boost/smart_ptr/shared_ptr.hpp

Problemi correlati