高翔slam十四讲第7讲碰到的一些问题总结

本文档详细记录了在使用KDevelop进行项目开发时遇到的配置失败、CMakeLists.txt错误、编译标准不兼容以及源文件冲突等问题。针对这些问题,提供了修改CMakeLists.txt文件、调整编译选项以及分别编译不同源文件的解决方案,并解决了图片路径和依赖库的问题。通过这些步骤,可以确保项目成功编译并运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.图像读取问题参考如下:(有帮助的话,别忘了去点个赞)

 

 

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值