1.首先出现的情况是如下:
Failed to configure project 'ch7_1' (error message: Configuration failed.). As a result, KDevelop's code understanding will likely be broken.
To fix this issue, please ensure that the project's CMakeLists.txt files are correct, and KDevelop is configured to use the correct CMake version and settings. Then right-click the project item in the projects tool view and click 'Reload'.
问题分析:CMakeLists.txt 书写有误
解决:将list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
改为 list( APPEND CMAKE_MODULE_PATH /home/kbfvictory/Downloads/g2o/cmake_modules )
(改的时候看你当初安装g2o那个包在的位置 home/Ubuntu个人姓名/这个位置因人而异/g2o/cmake_modules)
2. 编译时出现/usr/local/include/g2o/core/base_fixed_sized_edge.h:174:32: error: ‘index_sequence’ is not a member of ‘std’
.....
一系列错误
解决办法:CMakeLists.txt中将 set(CMAKE_CXX_FLAGS "-std=c++11 -O2 ${SSE_FLAGS} -msse4") 改为 set( CMAKE_CXX_FLAGS "-std=c++14 -O3" )
3. orb_self.cpp 与 pose_estimation_3d2d.cpp 不能同时编译通过
在编译pose_estimation_3d2d.cpp时会出现
In file included from /usr/lib/gcc/x86_64-linux-gnu/7/include/smmintrin.h:811:0,
from /usr/lib/gcc/x86_64-linux-gnu/7/include/nmmintrin.h:31,
from /home/kbfvictory/Documents/slam_example/ch7_1/orb_self_1.cpp:7:
/usr/lib/gcc/x86_64-linux-gnu/7/include/popcntintrin.h: In function ‘void BfMatch(const std::vector<std::vector<unsigned int> >&, const std::vector<std::vector<unsigned int> >&, std::vector<cv::DMatch>&)’:
/usr/lib/gcc/x86_64-linux-gnu/7/include/popcntintrin.h:35:1: error: inlining failed in call to always_inline ‘int _mm_popcnt_u32(unsigned int)’: target specific option mismatch
_mm_popcnt_u32 (unsigned int __X)
原因分析:orb_self.cpp 需要用c++11的标准而pose_estimation3d2d.cpp需要用c++14的标准
解决办法:分开编译即在编译pose_estimation_3d2d.cpp时注释掉CMakeLists.txt中的orb_self.cpp编译和链接如下:
# add_executable(orb_self_1 orb_self_1.cpp)
# target_link_libraries(orb_self_1 ${OpenCV_LIBS} )
4.找不到图片相关问题
解决办法:讲图像放置到build文件里面和你所编译产生的执行文件一起如下:
5.图像读取问题参考如下:(有帮助的话,别忘了去点个赞)