The problem occurs when I compiled g2opy on Mac OS X Mojave. The solution is to edit as follows:
// this is code is one before edit .def("x", (double (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::x) .def("y", (double (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::y) .def("z", (double (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::z) .def("w", (double (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::w) // this is code is one after edit .def("x", (const double & (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::x) .def("y", (const double & (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::y) .def("z", (const double & (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::z) .def("w", (const double & (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::w)
The problem is related to the return value of Eigen::Quaterniond::x(), y(), z(), and w(). As the following error message says, the return value is different.
In file included from /Users/oyamada/Documents/code/python/extern/g2opy/python/g2o.cpp:12:
/Users/oyamada/Documents/code/python/extern/g2opy/python/core/eigen_types.h:185:62: error:
address of overloaded function 'x' does not match required type 'double () const'
.def("x", (double (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::x)
^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/eigen3/Eigen/src/Geometry/Quaternion.h:66:44: note: candidate function has
different return type ('double' expected but has
'Eigen::QuaternionBase<Eigen::Quaternion<double, 0> >::CoeffReturnType'
(aka 'const double &'))
EIGEN_DEVICE_FUNC inline CoeffReturnType x() const { return this->derived().coeffs()....
^
/usr/local/include/eigen3/Eigen/src/Geometry/Quaternion.h:75:52: note: candidate function has
different return type ('double' expected but has
'Eigen::QuaternionBase<Eigen::Quaternion<double, 0> >::NonConstCoeffReturnType'
(aka 'double &'))
EIGEN_DEVICE_FUNC inline NonConstCoeffReturnType x() { return this->derived().coeffs().x(); }