[SLAM]高博视觉SLAM十四讲ch4中useSophus报错

news/2024/10/26 4:00:04/

问题描述

在正常安装了Sophus库后,运行高博的代码,发现如下错误

####
#### Running command: "make -j16 -l16" in "/home/a/SLAM/slam_ws/build"
####
Scanning dependencies of target useSophus
[ 33%] Built target hello
[ 33%] Built target hello_shared
[ 33%] Built target plotTrajectory
[ 44%] Built target helloSLAM
[ 55%] Built target useGeometry
[ 72%] Built target cooridinateTransform
[ 77%] Built target eigenMatrix
[ 83%] Building CXX object ch4/CMakeFiles/useSophus.dir/src/useSophus.cpp.o
[ 94%] Built target useHello
[100%] Linking CXX executable /home/a/SLAM/slam_ws/devel/lib/ch4/useSophus
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `std::make_unsigned<long>::type fmt::v8::detail::to_unsigned<long>(long)':
/usr/local/include/fmt/core.h:426: undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `std::make_unsigned<int>::type fmt::v8::detail::to_unsigned<int>(int)':
/usr/local/include/fmt/core.h:426: undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `void fmt::v8::print<Eigen::Product<Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Transpose<Eigen::Matrix<double, 3, 3, 0, 3, 3> const>, 0> const>(fmt::v8::basic_format_string<char, fmt::v8::type_identity<Eigen::Product<Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Transpose<Eigen::Matrix<double, 3, 3, 0, 3, 3> const>, 0> const>::type>, Eigen::Product<Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Transpose<Eigen::Matrix<double, 3, 3, 0, 3, 3> const>, 0> const&&)':
/usr/local/include/fmt/core.h:3208: undefined reference to `fmt::v8::vprint(fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `void fmt::v8::print<>(fmt::v8::basic_format_string<char>)':
/usr/local/include/fmt/core.h:3208: undefined reference to `fmt::v8::vprint(fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `void fmt::v8::print<double>(fmt::v8::basic_format_string<char, fmt::v8::type_identity<double>::type>, double&&)':
/usr/local/include/fmt/core.h:3208: undefined reference to `fmt::v8::vprint(fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `void fmt::v8::print<>(fmt::v8::basic_format_string<char>)':
/usr/local/include/fmt/core.h:3208: undefined reference to `fmt::v8::vprint(fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `fmt::v8::basic_format_parse_context<char, fmt::v8::detail::error_handler>::on_error(char const*)':
/usr/local/include/fmt/core.h:693: undefined reference to `fmt::v8::detail::error_handler::on_error(char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `char const* fmt::v8::detail::parse_align<char, fmt::v8::detail::specs_checker<fmt::v8::detail::dynamic_specs_handler<fmt::v8::basic_format_parse_context<char, fmt::v8::detail::error_handler> > >&>(char const*, char const*, fmt::v8::detail::specs_checker<fmt::v8::detail::dynamic_specs_handler<fmt::v8::basic_format_parse_context<char, fmt::v8::detail::error_handler> > >&)':
/usr/local/include/fmt/core.h:2302: undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `int fmt::v8::detail::parse_nonnegative_int<char>(char const*&, char const*, int)':
/usr/local/include/fmt/core.h:2278: undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `char const* fmt::v8::detail::parse_width<char, fmt::v8::detail::specs_checker<fmt::v8::detail::dynamic_specs_handler<fmt::v8::basic_format_parse_context<char, fmt::v8::detail::error_handler> > >&>(char const*, char const*, fmt::v8::detail::specs_checker<fmt::v8::detail::dynamic_specs_handler<fmt::v8::basic_format_parse_context<char, fmt::v8::detail::error_handler> > >&)':
/usr/local/include/fmt/core.h:2399: undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `void fmt::v8::detail::check_string_type_spec<fmt::v8::detail::error_handler&>(fmt::v8::presentation_type, fmt::v8::detail::error_handler&)':
/usr/local/include/fmt/core.h:2805: undefined reference to `fmt::v8::detail::error_handler::on_error(char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `void fmt::v8::detail::format_value<char, Eigen::Product<Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Transpose<Eigen::Matrix<double, 3, 3, 0, 3, 3> const>, 0> >(fmt::v8::detail::buffer<char>&, Eigen::Product<Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Transpose<Eigen::Matrix<double, 3, 3, 0, 3, 3> const>, 0> const&, fmt::v8::detail::locale_ref)':
/usr/local/include/fmt/ostream.h:75: undefined reference to `std::locale fmt::v8::detail::locale_ref::get<std::locale>() const'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `fmt::v8::detail::fill_t<char>::operator=(fmt::v8::basic_string_view<char>)':
/usr/local/include/fmt/core.h:2041: undefined reference to `fmt::v8::detail::throw_format_error(char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `char const* fmt::v8::detail::do_parse_arg_id<char, fmt::v8::detail::parse_width<char, fmt::v8::detail::specs_checker<fmt::v8::detail::dynamic_specs_handler<fmt::v8::basic_format_parse_context<char, fmt::v8::detail::error_handler> > >&>(char const*, char const*, fmt::v8::detail::specs_checker<fmt::v8::detail::dynamic_specs_handler<fmt::v8::basic_format_parse_context<char, fmt::v8::detail::error_handler> > >&)::width_adapter&>(char const*, char const*, fmt::v8::detail::specs_checker<fmt::v8::detail::dynamic_specs_handler<fmt::v8::basic_format_parse_context<char, fmt::v8::detail::error_handler> > >&)':
/usr/local/include/fmt/core.h:2346: undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `char const* fmt::v8::detail::do_parse_arg_id<char, fmt::v8::detail::parse_precision<char, fmt::v8::detail::specs_checker<fmt::v8::detail::dynamic_specs_handler<fmt::v8::basic_format_parse_context<char, fmt::v8::detail::error_handler> > >&>(char const*, char const*, fmt::v8::detail::specs_checker<fmt::v8::detail::dynamic_specs_handler<fmt::v8::basic_format_parse_context<char, fmt::v8::detail::error_handler> > >&)::precision_adapter&>(char const*, char const*, fmt::v8::detail::specs_checker<fmt::v8::detail::dynamic_specs_handler<fmt::v8::basic_format_parse_context<char, fmt::v8::detail::error_handler> > >&)':
/usr/local/include/fmt/core.h:2346: undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `int fmt::v8::detail::get_dynamic_spec<fmt::v8::detail::width_checker, fmt::v8::basic_format_arg<fmt::v8::basic_format_context<fmt::v8::appender, char> >, fmt::v8::detail::error_handler>(fmt::v8::basic_format_arg<fmt::v8::basic_format_context<fmt::v8::appender, char> >, fmt::v8::detail::error_handler)':
/usr/local/include/fmt/format.h:2287: undefined reference to `fmt::v8::detail::error_handler::on_error(char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `int fmt::v8::detail::get_dynamic_spec<fmt::v8::detail::precision_checker, fmt::v8::basic_format_arg<fmt::v8::basic_format_context<fmt::v8::appender, char> >, fmt::v8::detail::error_handler>(fmt::v8::basic_format_arg<fmt::v8::basic_format_context<fmt::v8::appender, char> >, fmt::v8::detail::error_handler)':
/usr/local/include/fmt/format.h:2287: undefined reference to `fmt::v8::detail::error_handler::on_error(char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `void fmt::v8::detail::check_string_type_spec<fmt::v8::detail::error_handler>(fmt::v8::presentation_type, fmt::v8::detail::error_handler&&)':
/usr/local/include/fmt/core.h:2805: undefined reference to `fmt::v8::detail::error_handler::on_error(char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `unsigned long long fmt::v8::detail::width_checker<fmt::v8::detail::error_handler>::operator()<int, 0>(int)':
/usr/local/include/fmt/format.h:2249: undefined reference to `fmt::v8::detail::error_handler::on_error(char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o: in function `unsigned long long fmt::v8::detail::width_checker<fmt::v8::detail::error_handler>::operator()<unsigned int, 0>(unsigned int)':
/usr/local/include/fmt/format.h:2249: undefined reference to `fmt::v8::detail::error_handler::on_error(char const*)'
/usr/bin/ld: CMakeFiles/useSophus.dir/src/useSophus.cpp.o:/usr/local/include/fmt/format.h:2249: more undefined references to `fmt::v8::detail::error_handler::on_error(char const*)' follow
collect2: error: ld returned 1 exit status
make[2]: *** [ch4/CMakeFiles/useSophus.dir/build.make:84/home/a/SLAM/slam_ws/devel/lib/ch4/useSophus] 错误 1
make[1]: *** [CMakeFiles/Makefile2:878:ch4/CMakeFiles/useSophus.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2
Invoking "make -j16 -l16" failed

原因分析:

可能是因为没有进行连接吧,编译器没有找到Sophus库

解决方案:

只需要将CMakeList.txt文件改一下就好了

原文件

find_package(Sophus REQUIRED)
include_directories(${Sophus_INCLUDE_DIRS}) 
add_executable( useSophus useSophus.cpp)

更改后文件

include_directories("/usr/include/eigen3")
set(CMAKE_BUILD_TYPE "Debug")
find_package(Sophus REQUIRED)
include_directories(${Sophus_INCLUDE_DIRS}) 
add_executable( useSophus useSophus.cpp)
target_link_libraries(useSophus Sophus::Sophus) 

http://www.ppmy.cn/news/527941.html

相关文章

蓝桥杯嵌入式CT117E-M4学习笔记03-MDK环境安装

文章目录 前言一、Keil MDK-Arm 集成开发环境 保姆级安装教程~安装教程&#xff1a; 总结 前言 从今天开始就是要进行开发板的正式学习了&#xff0c;在学习之前&#xff0c;我们当然要先把开发环境给安装好咯&#xff0c;根据官方给出的开发环境&#xff0c;我们进行环境搭建…

蓝桥杯嵌入式第十届学习记录

1&#xff1a;拷贝LCD工程代码作为模板 2&#xff1a;注意放置代码得顺序 3&#xff1a;注意公共头函数键盘 4&#xff1a;串口配置出来方便dubug模式 正常接收数据 5:记得打定时器中断&#xff08;去历程定时器里面寻找&#xff01;&#xff09; 6&#xff1a;细节地方 7;LCD每…

OCaml入门

1. 引言 OCaml为函数式编程语言。 相关入门资料有&#xff1a; o1-labs的 OCaml By Examples&#xff08;具体见https://github.com/o1-labs/ocamlbyexample&#xff09;OCaml官方教程OCaml手册 OCaml变量与Rust类似&#xff0c;默认是not mutable的。如下例&#xff0c;是…

①【蓝桥杯】STM32G4嵌入式竞赛实训平台(CT117E-M4)学习——按键

写在前面—— 由于众所周知的原因&#xff0c;我们封校了&#xff0c;和舍友们在宿舍里开始上网课&#xff0c;有这一段宝贵的时光也属实难得。前段时间报名了蓝桥杯嵌入式的比赛&#xff0c;虽然自己学的很菜&#xff0c;但还是想努力一下&#xff0c;把备赛的过程和比赛的过程…

蓝桥杯嵌入式CT117E-M4学习笔记02-STM32G431RBT6芯片学习

文章目录 前言一、芯片简介二、时钟学习三、SRAM学习四、总线矩阵学习五、GPIO学习总结 前言 首先学习了解一下蓝桥杯嵌入式CT117E-M4开发板的主控芯片STM32G431RBT6&#xff0c;本文仅为个人学习成果总结&#xff0c;如有错误&#xff0c;恳请指正。 一、芯片简介 上图为STM…

蓝桥杯嵌入式CT117E-M4学习笔记06-LED灯实验

文章目录 前言一、实验原理二、配置步骤三、LED灯闪烁四、LED流水灯总结 前言 经过前面几个笔记的学习&#xff0c;我们已经了解了蓝桥杯嵌入式的比赛大纲&#xff0c;了解了STM32G431芯片的基本信息&#xff0c;以及开发环境的配置&#xff0c;接下来就可以针对开发板来进行学…

蓝桥杯嵌入式CT117E-M4学习笔记01-竞赛大纲

文章目录 前言一、蓝桥杯嵌入式竞赛大纲1.参赛资格2.竞赛用时3.竞赛形式4.试题形式5. 赛场设备设施6. 试题涉及的基础知识7. 分值比例8. 评分 总结&报名链接 前言 本人为电子信息专业大四应届毕业生&#xff0c;参加过各式各样的学科类竞赛&#xff0c;这还是第一次参加蓝…

Spring Boot中使用thymeleaf以及各种取值,判断,选择,截取等方式

Spring Boot中使用thymeleaf Spring Boot支持FreeMarker、Groovy、Thymeleaf和Mustache四种模板解析引擎&#xff0c;官方推荐使用Thymeleaf。 spring-boot-starter-thymeleaf 在Spring Boot中使用Thymeleaf只需在pom中加入Thymeleaf的starter即可&#xff1a; <depende…