使用boost :: enable_shared_from_this时出现不完整的类型错误

时间:2012-05-09 04:12:07

标签: c++ shared-ptr

在以下一行

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

我收到错误:

错误:无效使用不完整类型struct boost::enable_shared_from_this<Symbol> /usr/include/boost/smart_ptr/shared_ptr.hpp:63:错误:声明struct boost::enable_shared_from_this<Symbol>

知道为什么我会收到此错误。符号是一个抽象类(如果重要)

1 个答案:

答案 0 :(得分:13)

哎呀。错误是因为我没有包含定义 enable_shared_from_this的标头 (这是boost / enable_shared_from_this.hpp)。

在/usr/include/boost/smart_ptr/shared_ptr.hpp中只有声明了

相关问题