当前位置: 首页 > 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})

相关文章:

  • 【Nodejs】用pm2管理nodejs服务
  • PyCharm中通过命令行执行`pip`命令下载到哪里了:虚拟环境目录下
  • 3 算法1-3 回文质数
  • 使用esp32接入大模型(http请求)
  • AI关于SHAP分析与列线图(算法)解释线性模型矛盾之处的解释
  • 网络流算法: Edmonds-Karp算法
  • PostgreSQL的基本使用
  • PCEP介绍
  • C++ ++++++++++
  • 上海市计算机学会竞赛平台2024年4月月赛丙组排序分数
  • HTML元素,标签到底指的哪块部分?单双标签何时使用?
  • MySQL Connector/J下载
  • 【学习笔记】三维点云空洞修复介绍(二)Grids-based
  • 20250225-代码笔记03-class CVRPModel AND other class
  • 每日十个计算机专有名词 (7)
  • 三个小时学完vue3(一)
  • L2-043 龙龙送外卖(dfs)
  • Java中的ArrayDeque
  • 安全运营的“黄金4小时“:如何突破告警疲劳困局
  • WSDM24-因果推荐|因果去偏的可解释推荐系统
  • react wordpress 知乎/营销排名seo
  • 1网站建设公司/福州短视频seo公司
  • 北京网站制作公司哪家好/快手刷评论推广网站
  • 需要企业网站建设/网上营销的平台有哪些
  • 电商网站建设浩森宇特/域名信息查询
  • 怎么样让网站网址有图标/深圳seo专家