当前位置: 首页 > news >正文

【无标题】Ubuntu22.04编译视觉十四讲slambook2 ch4时fmt库的报错

Ubuntu22.04编译视觉十四讲slambook2 ch4时fmt库的报错

cmake ..顺利,make后出现如下报错:

in function `std::make_unsigned<int>::type fmt::v8::detail::to_unsigned<int>(int)':
trajectoryError.cpp:(.text._ZN3fmt2v86detail11to_unsignedIiEENSt13make_unsignedIT_E4typeES4_[_ZN3fmt2v86detail11to_unsignedIiEENSt13make_unsignedIT_E4typeES4_]+0x23): undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'

重点:undefined reference to ‘fmt::v8::XXX)’

这个错误是链接阶段的错误,表明在链接时找不到 fmt::v8::detail::assert_fail 这个符号,通常与 fmt 库的使用或链接设置有关。

检查CMakeLists.txt
外面那个CMakeLists.txt没有,example文件夹下面的CMakeLists.txt有 fmt

option(USE_UBUNTU_20 "Set to ON if you are using Ubuntu 20.04" OFF)
find_package(Pangolin REQUIRED)
if(USE_UBUNTU_20)message("You are using Ubuntu 20.04, fmt::fmt will be linked")find_package(fmt REQUIRED)set(FMT_LIBRARIES fmt::fmt)
endif()
include_directories(${Pangolin_INCLUDE_DIRS})
add_executable(trajectoryError trajectoryError.cpp)
target_link_libraries(trajectoryError ${Pangolin_LIBRARIES} ${FMT_LIBRARIES})

这里是使用ubuntu20.04才会进入if里面执行:
查找 fmt 库(fmt 是一个现代的格式化库,用于 C++ 格式化输出。)
设置 FMT_LIBRARIES 变量为 fmt::fmt,它指的是 fmt 库的 CMake 目标名称

把内容修改成下面这样:

# option(USE_UBUNTU_20 "Set to ON if you are using Ubuntu 20.04" OFF)
find_package(Pangolin REQUIRED)
# if(USE_UBUNTU_20)
#     message("You are using Ubuntu 20.04, fmt::fmt will be linked")
#     find_package(fmt REQUIRED)
#     set(FMT_LIBRARIES fmt::fmt)
# endif()
find_package(fmt REQUIRED)
set(FMT_LIBRARIES fmt::fmt)
include_directories(${Pangolin_INCLUDE_DIRS})
add_executable(trajectoryError trajectoryError.cpp)
target_link_libraries(trajectoryError ${Pangolin_LIBRARIES} ${FMT_LIBRARIES})
http://www.lryc.cn/news/545769.html

相关文章:

  • macos下myslq图形化工具之Sequel Ace
  • 【AHK】资源管理器自动化办公实例/自动连点设置
  • 通用查询类接口数据更新的另类实现
  • Linux ls 命令
  • 【问题记录】Go项目Docker中的consul访问主机8080端口被拒绝
  • 面试题:说一下你对DDD的了解?
  • React低代码项目:问卷编辑器 I
  • 蓝桥杯2024年真题java B组 【H.拼十字】
  • Spring MVC 程序开发(1)
  • PyCharm接入本地部署DeepSeek 实现AI编程!【支持windows与linux】
  • Linux服务升级:Almalinux 升级 DeepSeek-R1
  • Linux操作系统5- 补充知识(可重入函数,volatile关键字,SIGCHLD信号)
  • ctfshow刷题笔记—栈溢出—pwn61~pwn64
  • java23种设计模式-责任链模式
  • 新一代跨境电商ERP系统:从订单到发货的全流程自动化管理
  • 苹果廉价机型 iPhone 16e 影像系统深度解析
  • hive 面试题
  • VScode在windows10上使用clang-format
  • AWS API Gateway灰度验证实现
  • 【每日八股】MySQL篇(三):索引(上)
  • 在Pycharm中将ui文件修改为py文件
  • 看视频学习方法总结
  • Matlab 大量接单
  • 《深度剖析:生成对抗网络中生成器与判别器的高效协作之道》
  • Android6到Android15版本新增的功能和api
  • 【现代Web布局与动画技术:卡片组件实战分享】
  • 计算机网络之传输层(传输层提供的服务)
  • FPGA开发,使用Deepseek V3还是R1(1):应用场景
  • 哈希表和STL —— unorderde_set/unordered_map【复习笔记】
  • 计算机毕业设计SpringBoot+Vue.js体育馆使用预约平台(源码+文档+PPT+讲解)