赞
踩
报错信息:
- CMake Error at CMakeLists.txt:12 (find_package):
- By not providing "FindG2O.cmake" in CMAKE_MODULE_PATH this project has
- asked CMake to find a package configuration file provided by "G2O", but
- CMake did not find one.
-
- Could not find a package configuration file provided by "G2O" with any of
- the following names:
-
- G2OConfig.cmake
- g2o-config.cmake
-
- Add the installation prefix of "G2O" to CMAKE_PREFIX_PATH or set "G2O_DIR"
- to a directory containing one of the above files. If "G2O" provides a
- separate development package or SDK, be sure it has been installed.
-
-
- -- Configuring incomplete, errors occurred!
- See also "/home/chi/slambook2/ch6/g2oCurveFitting/build/CMakeFiles/CMakeOutput.log".
错误原因:
参考了凌啸天与zhiwei121等人的博客,原因应该是没有找到相应的库文件所致。
解决方法:
根据zhiwei121的解决方法,将要保证build文件夹与cmake的文件夹在同一级,在高翔博士的代码中是附有cmake文件的。
对应的CMakeLists.txt中
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
也要加入自己写的CMakeLists.txt中,cmake ..通过。
注1:按笔者贫瘠的编程知识,这种解决方法更像是通过外挂文件“解决”了库文件索引问题,似乎是治标不治本,凌啸天的处理方法可能更好,这里没有继续尝试了。
注2:根据youxiaogeo的解决方法,直接在CMakeLists.txt文件中添加G2O的库路径也可解决问题,如下所示:
- LIST( APPEND CMAKE_MODULE_PATH /XXX/g2o/cmake_modules )
- SET( G2O_ROOT /home/xxx/g2o )
- FIND_PACKAGE( G2O REQUIRED )
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。