我在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,这给我带来了很多问题。
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.发布于 2017-07-26 09:14:55
听起来您没有链接到库;这会导致引用未定义。如果要调用链接器(G++可以是链接器),那么添加-lglog添加结束,然后将其链接到glog。
同样,您也应该链接到ceres。
这里有一个片段来自我需要链接的东西来使用一个使用Ceres的库。在CMake中。我建议您从底部/结尾开始,并将内容添加到顶部以进行修复,您可能需要使用-l前缀来表示您需要链接它们。我建议使用cmake,这样您就可以简单地将这个列表粘贴到target_link_libraries(可执行文件)中,并删除不必要的/未使用的库;
umfpack
cxsparse
stlplus
glog
gomp
ccolamd
btf
klu
cholmod
lapack
blas
camd
amd
pthread
cereshttps://stackoverflow.com/questions/44790239
复制相似问题