踩坑 视觉SLAM 十四讲第二版 ch7 编译及运行问题

1.make时报错:

CMakeFiles/pose_estimation_3d3d.dir/pose_estimation_3d3d.cpp.o: In function `fmt::v8::appender fmt::v8::detail::write<char, fmt::v8::appender>(fmt::v8::appender, fmt::v8::basic_string_view<fmt::v8::type_identity<char>::type>, fmt::v8::basic_format_specs<char> const&, fmt::v8::detail::locale_ref) [clone .isra.1336]':
pose_estimation_3d3d.cpp:(.text+0x68c7): undefined reference to `fmt::v8::detail::error_handler::on_error(char const*)'

等等 有关 In function `fmt 的问题,就是说明,没有链接到fmt,我们只需要在cmakelist.txt中加入fmt 链接即可,方法如下:

在报错的cpp文件位置 下面加入 ${FMT_LIBRARIES} fmt,最后两部分修改后如下:

add_executable(pose_estimation_3d2d pose_estimation_3d2d.cpp)
target_link_libraries(pose_estimation_3d2d
        g2o_core g2o_stuff
        ${OpenCV_LIBS}
        ${FMT_LIBRARIES} fmt)      

add_executable(pose_estimation_3d3d pose_estimation_3d3d.cpp)
target_link_libraries(pose_estimation_3d3d
        g2o_core g2o_stuff
        ${OpenCV_LIBS}
        ${FMT_LIBRARIES} fmt)

2.cmake ..时 报错:

CMake Error at CMakeLists.txt:9 (add_executable):
  Target "useSophus" links to target "Sophus::Sophus" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

解决方案:
在CMakeLists.txt中:加入

set(Sophus_DIR "/home/你自己的路径/Sophus/build")

重新编译: 搞定!

3.运行问题

 3.1  ./orb_cv 报错提示 usage: feature_extraction img1 img2

 因为img1和img2的位置需要你自己输入,因此输入命令:

./orb_cv ../1.png ../2.png

 3.2 ./orb_self 找不到图片路径

将源码相对路径修改为:

string first_file = "../1.png";
string second_file = "../2.png";

或者直接改成你自己的绝对路径也行,保存后重新编译,再次运行 ./orb_self

 3.3 ./pose_estimation_2d2d 或 ./triangulation 或./pose_estimation_3d2d  或./pose_estimation_3d3d 

 报错提示 usage: feature_extraction img1 img2

一样在命令后加入  ../1.png ../2.png 即可

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值