C ++, g2o (Graph-Framework), qcreator, undefined method reference

I am trying to use the g2o library in a C ++ project. I installed the library in two systems

  • OpenSuse - dependencies through zypper install, g2o by compiling as directed
  • Ubuntu - all dependencies via apt-get, g2o by compiling as directed

My .pro file contains these links to link to .so libaries:

INCLUDEPATH += /home/rhun/data/Coding/g2o/trunk/lib/ LIBS += -L/home/rhun/data/Coding/g2o/trunk/lib/ LIBS += -lg2o_calibration_odom_laser LIBS += -lg2o_cli LIBS += -lg2o_core LIBS += -lg2o_csparse_extension LIBS += -lg2o_ext_freeglut_minimal LIBS += -lg2o_interface LIBS += -lg2o_parser LIBS += -lg2o_simulator LIBS += -lg2o_solver_csparse LIBS += -lg2o_solver_dense LIBS += -lg2o_solver_eigen LIBS += -lg2o_solver_pcg LIBS += -lg2o_solver_slam2d_linear LIBS += -lg2o_solver_structure_only LIBS += -lg2o_stuff LIBS += -lg2o_tutorial_slam2d LIBS += -lg2o_types_data LIBS += -lg2o_types_icp LIBS += -lg2o_types_sba LIBS += -lg2o_types_sclam2d LIBS += -lg2o_types_sim3 LIBS += -lg2o_types_slam2d LIBS += -lg2o_types_slam3d INCLUDEPATH += /usr/include/suitesparse/ INCLUDEPATH += /home/rhun/data/Coding/g2o/tags/before-github-sync/ INCLUDEPATH += /home/rhun/data/Coding/g2o/tags/before-github-sync/EXTERNAL/eigen3/ INCLUDEPATH += /home/rhun/data/Coding/g2o/trunk/build/ 

When I try # to turn things on, I see everything in the drop-down menu.

However, I keep getting this message:

 error: undefined reference to 'g2o::SparseOptimizer::setMethod(g2o::SparseOptimizer::Method)' 

I have been stuck here for several hours. Could you shed some light? Thanks!:)

0
source share
1 answer

OK, I downloaded the version of g2o that sends here (http://openslam.org/g2o.html) , but that did not work for me. As soon as I downloaded the version that is sent via github , the problems disappeared. The github version is the most up-to-date version, and corrections are applied by the creators if necessary, which means that also the installation of makefiles is not required during installation.

The only problem is that some changes were made to this new version, which lead to the fact that some examples on the Internet are outdated, but it's okay;) (it was not difficult to get up and run, looking at old textbooks, new samples, documentation and source code)

I will copy here the answer of Rainer Kuemmerle (author of g2o) found here

Indeed, the API has changed quite a bit, which leads to the fact that the code from OpenSLAM is incompatible with the current code posted here on github. We can do little by adding new features that require us to crack the old API. It would be best to adapt code that uses g2o. For example, setMethod needs to be replaced by setting the appropriate OptimizationAlgorithm.

0
source

Source: https://habr.com/ru/post/955268/


All Articles