我试图在一个g2o项目中使用c++库。我在两个系统中安装了这个库
为了链接到.pro库,我的.so文件包括以下内容:
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/当我尝试包含事物时,我可以看到下拉菜单中的所有内容。
然而,我一直收到这样的信息:
error: undefined reference to 'g2o::SparseOptimizer::setMethod(g2o::SparseOptimizer::Method)'我被困在这里好几个小时了。你能放点光吗?谢谢!:)
发布于 2013-10-09 12:00:31
好的,我下载了发布这里(http://openslam.org/g2o.html) )的这里(http://openslam.org/g2o.html) )版本,但是它对我不起作用。一旦我下载了通过github的船只的版本,问题就消失了。github版本是最新版本,而且在创建者需要时也会应用补丁,这意味着在安装过程中也不需要修改makefile。
唯一的“问题”是,这个新版本引入了一些修改,这使得一些在线发现的例子有点过时,但并不可怕;(通过查找和旧教程、新示例、文档和源代码,启动和运行并不困难)。
我将在这里复制雷纳·库默尔 (g2o的作者)的答案,found 这里
事实上,API发生了很大的变化,这导致了这样一个事实:来自OpenSLAM的代码用例与当前托管在github上的代码不兼容。我们对此无能为力,增加新特性需要我们打破旧的API。最好是修改使用g2o的代码。例如,必须将setMethod替换为设置相应的OptimizationAlgorithm。
https://stackoverflow.com/questions/19235299
复制相似问题