首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用ceres解决程序,glog

无法使用ceres解决程序,glog
EN

Stack Overflow用户
提问于 2017-06-27 21:29:13
回答 1查看 1.3K关注 0票数 0

我在ubuntu中安装ceres,并使用sudo安装libgoogle-glog中的http://ceres-solver.org/installation.html Linux部分中的所有命令行来使安装看起来像是我已经安装了ceres解决程序及其依赖关系,没有问题。但是,当我试图运行测试文件bin/simple_bundle_ ../ceres-solver-1.9.0/data/problem-16-22106-pre.tx时,它显示出无法打开文件../ceres-solver-1.9.0/data/problem-16-22106-pre.tx,然后在教程中编译helloworld,使用命令g++ -i/usr/g++/g++3 helloworld.cpp -o helloworld,这给我带来了很多问题。

代码语言:javascript
复制
undefined reference to `google::InitGoogleLogging(char const*)' helloworld.cpp:(.text+0x104): undefined reference to`ceres::Problem::Problem()' helloworld.cpp:(.text+0x155): undefined reference to `ceres::Problem::AddResidualBlock(ceres::CostFunction\*, ceres::LossFunction\*, double\*)'   I didn't list them all. But seems it cannot find things about google at all. Hope you can help me!!    it gives me a mountain of problems.
EN

回答 1

Stack Overflow用户

发布于 2017-07-26 09:14:55

听起来您没有链接到库;这会导致引用未定义。如果要调用链接器(G++可以是链接器),那么添加-lglog添加结束,然后将其链接到glog。

同样,您也应该链接到ceres。

这里有一个片段来自我需要链接的东西来使用一个使用Ceres的库。在CMake中。我建议您从底部/结尾开始,并将内容添加到顶部以进行修复,您可能需要使用-l前缀来表示您需要链接它们。我建议使用cmake,这样您就可以简单地将这个列表粘贴到target_link_libraries(可执行文件)中,并删除不必要的/未使用的库;

代码语言:javascript
复制
    umfpack
    cxsparse
    stlplus
    glog
    gomp
    ccolamd
    btf
    klu
    cholmod
    lapack
    blas
    camd
    amd
    pthread
    ceres
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44790239

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档