c++, g2o (Graph-Framework), qcreator, 未定义的方法引用 [英] c++, g2o (Graph-Framework), qcreator, undefined reference to methods

查看:56
本文介绍了c++, g2o (Graph-Framework), qcreator, 未定义的方法引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 C++ 项目中使用 g2o 库.我在两个系统中安装了库

I'm trying to use the g2o library in a c++ project. I installed the library in two systems

  • OpenSuse - 通过 zypper install 依赖,g2o 根据指示编译
  • Ubuntu - 通过 apt-get、g2o 根据指示编译所有依赖项

我的 .pro 文件包含这些,以便链接到 .so 库:

My .pro file includes these, in order to link to the .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/

当我尝试#include 时,我可以在下拉菜单中看到所有内容.

When I try to #include things, I can see everything in the drop down menu.

但是,我不断收到这条消息:

However, I keep getting this message:

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

我被困在这里好几个小时了.你能解释一下吗?谢谢!:)

I'm stuck for hours here. Could you please shed some light? Thank you! :)

推荐答案

好的,我下载了发布的 g2o 版本 在这里(http://openslam.org/g2o.html),但它对我不起作用.一旦我下载了通过github发布的版本,问题就消失了.github 版本是最新版本,而且只要创建者需要,就会应用补丁,这意味着在安装过程中也不需要调整 makefile.

OK, I downloaded the version of g2o that ships here (http://openslam.org/g2o.html), but it didn't work for me. Once I downloaded the version that ships through github, problems were gone. The github version is the most up-to-date version, and also patches are applied whenever needed by the creators, and that means that also during installation no tweaking of makefiles was needed.

唯一的问题"是,这个新版本引入了一些变化,这使得网上找到的一些例子有点过时,但没什么可怕的;)(通过查看旧教程、新示例、文档和源代码,启动和运行并不难)

The only "problem" is that, this new version introduced some changes, which makes some examples found online a bit outdated, but nothing scary ;) (it was not difficult to get up and running, by looking and old tutorials, new samples, documentation and source code)

我将在此处复制 Rainer Kuemmerle(g2o 的作者)的答案,发现 这里

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

确实 API 发生了很大变化,这导致 OpenSLAM 的代码案例与 github 上托管的当前代码不兼容.我们对此无能为力,添加新功能需要我们打破旧 API.最好的办法是调整使用 g2o 的代码.例如,setMethod 必须通过设置相应的 OptimizationAlgorithm 来替换.

Indeed the API changed quite a bit which leads to the fact, that the code-case from OpenSLAM is not compatible with the current code hosted here on github. There is not much we can do about this, adding new features required us to break the old API. The best would be to adapt the code that uses g2o. For example, setMethod has to be replaced by setting the corresponding OptimizationAlgorithm.

这篇关于c++, g2o (Graph-Framework), qcreator, 未定义的方法引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆