编译cmake项目链接ceres库时名称没有写对导致报错:
myCeres.cpp:(.text.startup+0x247): undefined reference to `ceres::Problem::Problem()'
myCeres.cpp:(.text.startup+0x2aa): undefined reference to `ceres::CostFunction::CostFunction()'
myCeres.cpp:(.text.startup+0x31d): undefined reference to `ceres::Problem::AddResidualBlock(ceres::CostFunction*, ceres::LossFunction*, double* const*, int)'
myCeres.cpp:(.text.startup+0x905): undefined reference to `ceres::Solve(ceres::Solver::Options const&, ceres::Problem*, ceres::Solver::Summary*)'
myCeres.cpp:(.text.startup+0x97b): undefined reference to `ceres::Solver::Summary::BriefReport[abi:cxx11]() const'
myCeres.cpp:(.text.startup+0xa1a): undefined reference to `ceres::Problem::~Problem()'
myCeres.cpp:(.text.startup+0xb83): undefined reference to `ceres::Problem::~Problem()'
myCeres.cpp:(.text.startup+0xb95): undefined reference to `ceres::CostFunction::~CostFunction()'
解决方法
在链接ceres库时使用CERES_LIBRARIES
,而不是CERES_LIBS
add_executable(myCeres myCeres.cpp)
target_link_libraries(myCeres ${OpenCV_LIBS} ${CERES_LIBRARIES})
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)