lundi 24 août 2015

error C2027: use of undefined type 'boost::python::detail::reference_existing_object_requires_a_pointer_or_reference_return_type

I get the error reference_existing_object_requires_a_pointer_or_reference_return_type.

Here's the code.

boost::shared_ptr<CDB::Basic> GetCdbWrapper(boost::shared_ptr<A> cmd)
    {
        return cmd->Cdb();
    }
}

virtual boost::shared_ptr<CDB::Basic> Cdb() { 
    boost::shared_ptr<CDB::Basic> CdbObj;
    return CdbObj;
}
boost::shared_ptr<CDB::Basic> GetCdb() { 
    return this->Cdb(); 
}


class_<A, bases<Core::CommandBase>, boost::shared_ptr<A>, boost::noncopyable, >("A",
    ":description:\n",
    boost::python::no_init
)

.def("Cdb", &A::GetCdb,
    ":description:\n",
    return_value_policy<reference_existing_object>()
);

May I know what's wrong in above code. I get the compilation error as below.

error C2027: use of undefined type 'boost::python::detail::reference_existing_object_requires_a_pointer_or_reference_return_type<R>'
1>        with
1>        [
1>            R=result_t
1>        ]
1>        c:\boost\boost_1_47_0\boost\python\detail\caller.hpp(200) : while compiling class template member function 'PyObject *boost::python::detail::caller_arity<1>::impl<F,Policies,Sig>::operator ()(PyObject *,PyObject *)'
1>        with
1>        [
1>            F=boost::shared_ptr<CDB::Basic> (__thiscall A::* )(void),
1>            Policies=boost::python::return_value_policy<boost::python::reference_existing_object>,
1>            Sig=boost::mpl::vector2<boost::shared_ptr<CDB::Basic>, A &>
1>        ]

Aucun commentaire:

Enregistrer un commentaire