Hello. You have provided too much information. Small example with short problem description can definitely help ( you )
On Fri, Apr 16, 2010 at 11:42 AM, François ALLAIN <frall...@gmail.com> wrote: > Hello, I followed the "official" tutorial and others but still don't manage > to expose this pure virtual method (getPeptide) : > > ms_mascotresults.hpp > > class ms_mascotresults { > public: > > > > ms_mascotresults(ms_mascotresfile &resfile, > const unsigned int flags, > > > double minProbability, > int maxHitsToReport, > > > const char * unigeneIndexFile, > > > const char * singleHit = 0); > > > ... > > virtual ms_peptide getPeptide(const int q, const int p) const = 0; > > > } > > > > ms_mascotresults.cpp > > #include <boost/python.hpp> > > > using namespace boost::python; > > > #include "msparser.hpp" // which includes "ms_mascotresults.hpp" > > > using namespace matrix_science; > #include <iostream> > > > #include <sstream> > > struct ms_mascotresults_wrapper : ms_mascotresults, > wrapper<ms_mascotresults> { > > > ms_peptide getPeptide(const int q, const int p) { > > > this->get_override("getPeptide")(q); > > > this->get_override("getPeptide")(p); > > > } > }; > > BOOST_PYTHON_MODULE(ms_mascotresults) > > > { > class_<ms_mascotresults_wrapper, boost::noncopyable>("ms_mascotresults") > > > .def("getPeptide", pure_virtual(&ms_mascotresults::getPeptide) ) > > > ; > } > > > > Here are the bjam's errors : > > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:66: error: > cannot declare field > ‘boost::python::objects::value_holder<ms_mascotresults_wrapper>::m_held’ to > be of abstract type ‘ms_mascotresults_wrapper’ > > > ms_mascotresults.cpp:12: note: because the following virtual functions are > pure within ‘ms_mascotresults_wrapper’: > > > ... > include/ms_mascotresults.hpp:334: note: virtual > matrix_science::ms_peptide matrix_science::ms_mascotresults::getPeptide(int, > int) const > > > ms_mascotresults.cpp: In constructor > ‘ms_mascotresults_wrapper::ms_mascotresults_wrapper()’: > > > ms_mascotresults.cpp:12: error: no matching function for call to > ‘matrix_science::ms_mascotresults::ms_mascotresults()’ > > > include/ms_mascotresults.hpp:284: note: candidates are: > matrix_science::ms_mascotresults::ms_mascotresults(matrix_science::ms_mascotresfile&, > unsigned int, double, int, const char*, const char*) > > > include/ms_mascotresults.hpp:109: note: > matrix_science::ms_mascotresults::ms_mascotresults(const > matrix_science::ms_mascotresults&) > > > ... > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp: In constructor > ‘boost::python::objects::value_holder<Value>::value_holder(PyObject*) [with > Value = ms_mascotresults_wrapper]’: > > > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:137: note: > synthesized method ‘ms_mascotresults_wrapper::ms_mascotresults_wrapper()’ > first required here > > > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:137: error: > cannot allocate an object of abstract type ‘ms_mascotresults_wrapper’ > > > ms_mascotresults.cpp:12: note: since type ‘ms_mascotresults_wrapper’ has > pure vi > > Hello, I followed the "official" tutorial and others but still don't manage > to expose this pure virtual method (getPeptide) : > > ms_mascotresults.hpp > > class ms_mascotresults { > public: > > > > ms_mascotresults(ms_mascotresfile &resfile, > const unsigned int flags, > > > double minProbability, > int maxHitsToReport, > > > const char * unigeneIndexFile, > > > const char * singleHit = 0); > > > ... > > virtual ms_peptide getPeptide(const int q, const int p) const = 0; > > > } > > ms_mascotresults.cpp > > #include <boost/python.hpp> > > > using namespace boost::python; > > > #include "msparser.hpp" // which includes "ms_mascotresults.hpp" > > > using namespace matrix_science; > #include <iostream> > > > #include <sstream> > > struct ms_mascotresults_wrapper : ms_mascotresults, > wrapper<ms_mascotresults> { > > > ms_peptide getPeptide(const int q, const int p) { > > > this->get_override("getPeptide")(q); > > > this->get_override("getPeptide")(p); > > > } > }; > > BOOST_PYTHON_MODULE(ms_mascotresults) > > > { > class_<ms_mascotresults_wrapper, boost::noncopyable>("ms_mascotresults") > > > .def("getPeptide", pure_virtual(&ms_mascotresults::getPeptide) ) > > > ; > } > > Here are the bjam's errors : > > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:66: error: > cannot declare field > ‘boost::python::objects::value_holder<ms_mascotresults_wrapper>::m_held’ to > be of abstract type ‘ms_mascotresults_wrapper’ > > > ms_mascotresults.cpp:12: note: because the following virtual functions are > pure within ‘ms_mascotresults_wrapper’: > > > ... > include/ms_mascotresults.hpp:334: note: virtual > matrix_science::ms_peptide matrix_science::ms_mascotresults::getPeptide(int, > int) const > > > ms_mascotresults.cpp: In constructor > ‘ms_mascotresults_wrapper::ms_mascotresults_wrapper()’: > > > ms_mascotresults.cpp:12: error: no matching function for call to > ‘matrix_science::ms_mascotresults::ms_mascotresults()’ > > > include/ms_mascotresults.hpp:284: note: candidates are: > matrix_science::ms_mascotresults::ms_mascotresults(matrix_science::ms_mascotresfile&, > unsigned int, double, int, const char*, const char*) > > > include/ms_mascotresults.hpp:109: note: > matrix_science::ms_mascotresults::ms_mascotresults(const > matrix_science::ms_mascotresults&) > > > ... > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp: In constructor > ‘boost::python::objects::value_holder<Value>::value_holder(PyObject*) [with > Value = ms_mascotresults_wrapper]’: > > > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:137: note: > synthesized method ‘ms_mascotresults_wrapper::ms_mascotresults_wrapper()’ > first required here > > > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:137: error: > cannot allocate an object of abstract type ‘ms_mascotresults_wrapper’ > > > ms_mascotresults.cpp:12: note: since type ‘ms_mascotresults_wrapper’ has > pure virtual functions > > > > > > So I tried to change the constructor's signature by : > > class_<ms_mascotresults_wrapper, boost::noncopyable>("ms_mascotresults", > init<ms_mascotresfile &, const unsigned int, double, int, const char > *,const char *>()) > > > > > > > Giving these errors : > > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:66: error: > cannot declare field > ‘boost::python::objects::value_holder<ms_mascotresults_wrapper>::m_held’ to > be of abstract type ‘ms_mascotresults_wrapper’ > > > ms_mascotresults.cpp:12: note: because the following virtual functions are > pure within ‘ms_mascotresults_wrapper’: > > > include/ms_mascotresults.hpp:334: note: virtual > matrix_science::ms_peptide matrix_science::ms_mascotresults::getPeptide(int, > int) const > > > ... > ms_mascotresults.cpp:24: instantiated from here > > > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:137: error: no > matching function for call to > ‘ms_mascotresults_wrapper::ms_mascotresults_wrapper(matrix_science::ms_mascotresfile&, > const unsigned int&, const double&, const int&, const char* const&, const > char* const&)’ > > > ms_mascotresults.cpp:12: note: candidates are: > ms_mascotresults_wrapper::ms_mascotresults_wrapper(const > ms_mascotresults_wrapper&) > > > ms_mascotresults.cpp:12: note: > ms_mascotresults_wrapper::ms_mascotresults_wrapper() > > > > > > If I comment the virtual function getPeptide in the .hpp, it builds > perfectly with this constructor : > > class_<ms_mascotresults>("ms_mascotresults", init<ms_mascotresfile > &, const unsigned int, double, int, const char *,const char *>()) > > This is the first time I use Boost.Python so I don't really know what > happens inside, I don't understand this errors of candidates given the fact > that there is only one constructor in the .hpp ... > > > Thanks in advance for your help. > > Fallino > > > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig