博主这个错误可以说前无古人后无来者独一无二的错误,所以我就写给我自己看看的。。。

错误1:Failed to find ceres - Missing required ceres dependency: Eigen version ,please set Eigen3_DIR.


这个不是一般的错误,我看了其他博主的Eigen version后面有提示版本号的,我这个没有,哎!就是玩!

解决:重新安装Eigen3,我不觉得是版本问题我觉得是我eigen没装好,但是我看网上提示都是3.3.x的我就想试试好了。我是从3.4.9版本删了重新安装了一个3.3.9的Eigen(一定要删干净!)

sudo updatedb

local eigen3

sudo rm -r ...(删除的路径)

里面出现的地方都删了,可能有个share文件里面时删不掉的,不删也可以小问题!

然后上官网Eigen选一个适合的版本下载,后面就是安装啥的,不说了。

-----------------------------------------------------------------------------------------------------------------

错误2:

 Failed to find Ceres - Found Eigen dependency, but the version of Eigen
  found (3.3.9) does not exactly match the version of Eigen Ceres was
  compiled with happy().  This can cause subtle bugs by triggering violations
  of the One Definition Rule.  See the Wikipedia article
  http://en.wikipedia.org/wiki/One_Definition_Rule for more details

第一个小括号里3.3.9是我对应的eigen3的版本他能读取出来但是第二个小括号就不行了。

中文的意思是:

找不到Ceres-找到了Eigen依赖项,但该版本的Eigen发现(3.3.9)与Eigen Ceres was的版本不完全匹配使用happy()编译。这会触发违规行为,从而导致细微的错误一个定义规则的定义。

解决:找到CeresConfig.cmake.in(没有这个.in的也可以,如果你有权限编辑的话)

在里面添加这句话

set(CERES_EIGEN_VERSION 3.3.9)

随便加哪都可以,我看见一个博主说要加在数据区附件才行,我反正一开始也不行的。

这里是关键了,加完保持,然后

cd ceres-solver
cd build
cmake ..
make
sudo make install

这样我们添加进去的语句才会被执行,好像编译了一下的样子。

-----------------------------------------------------------------------------------------------------------------------

错误3:

test_01.cpp:(.text+0x20f): undefined reference to `ceres::Problem::Problem()'
/usr/bin/ld: test_01.cpp:(.text+0x333): undefined reference to `ceres::Solve(ceres::Solver::Options const&, ceres::Problem*, ceres::Solver::Summary*)'
/usr/bin/ld: test_01.cpp:(.text+0x34c): undefined reference to `ceres::Solver::Summary::BriefReport[abi:cxx11]() const'
/usr/bin/ld: test_01.cpp:(.text+0x463): undefined reference to `ceres::Problem::~Problem()'
/usr/bin/ld: test_01.cpp:(.text+0x513): undefined reference to `ceres::Problem::~Problem()'.....

很长的一段错误

解决:打开CMakeLists.txt

查看自己里面库连接是不是这样的

target_link_libraries(test_01 
 ${catkin_LIBRARIES} ${EIGEN_LIBRARIES} ${CERES_LIBRARIES}
 )

无论是库连接还是依赖地址都是有大小写区分的。。。

---------------------------------------------------------------------------------------------------------------------

错误4:

By not providing "FindCERES.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "CERES", but
  CMake did not find one.

  Could not find a package configuration file provided by "CERES" with any of
  the following names:

    CERESConfig.cmake
    ceres-config.cmake

  Add the installation prefix of "CERES" to CMAKE_PREFIX_PATH or set
  "CERES_DIR" to a directory containing one of the above files.  If "CERES"
  provides a separate development package or SDK, be sure it has been
  installed.

这个错误我一开始真的看不出来,不懂呀。

解决:

find_package(Ceres REQUIRED)

错误的是:find_package(CERES REQUIRED)

------------------------------------------------------------------------------------------------------------------

感谢博主文章:[1](13条消息) Found Eigen dependency, but the version of Eigen……编译出现问题_矩阵理论的博客-CSDN博客

[2](13条消息) 在TX2上安装VIINS-Mono——问题总结_W_Tortoise的博客-CSDN博客

[3](13条消息) undefined reference to `ceres::Problem::Problem()‘_柘尾鱼的博客-CSDN博客

还有很多毕竟这个库我整整头疼了3天百度上能查的都查了,没有直击病根但也是有缓解作用。

感谢!

最后说一句话:这个东西很玄学,真的!太玄了。

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐