解决 ubuntu 下编译文件的时候与 YAML 相关的的报错

输入:

复制代码
catkin build -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8

复制代码
catkin build airsim_tutorial_pkgs -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8

报错如下:

可能是缺少 yaml-cpp 文件,然后操作:

复制代码
sudo apt-get install yaml-cpp
sudo apt-get install ros-noetic-yaml

报错

编译:

复制代码
catkin build airsim_tutorial_pkgs -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8

报错

根据下面的错误,用 VScode 打开报错的文件

打开文件命令:

复制代码
cd /home/leaf/AirSim/ros/src/airsim_ros_pkgs
code .

yaml-cpp 没有链接到 airsim_ros

文件前面 fine_package 没有 find yaml-cpp,加上

这里不能在 find_package(catkin REQUIRED COMPONENTS 里面加入 yaml-cpp,因为这个里面是 find ros 包的,而 yaml-cpp 不是一个 ros 包,是系统的,只能单独写一个 find_packages,加入 yaml-cpp

再编译依旧报错

然后去网上下载 yaml-cpp

git clone 下来后直接安装到系统里

参考链接:

yaml-cpp的安装及使用_yaml cpp安装-CSDN博客

复制代码
 git clone https://github.com/jbeder/yaml-cpp.git
                cd yaml-cpp
                mkdir build && cd build
                cmake ..
                make -j16
                sudo make install

再编译就成功了

复制代码
catkin build airsim_tutorial_pkgs -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8
相关推荐
Eric.Lee202113 小时前
Ubuntu shell指定conda的python环境启动脚本
python·ubuntu·conda·shell
dubochao_xinxi18 小时前
✅ TensorRT Python 安装精简流程(适用于 Ubuntu 20.04+)
开发语言·python·ubuntu
yangshuo128119 小时前
风车OVF镜像:解放AI开发限制的Ubuntu精简系统
linux·人工智能·ubuntu
flypig哗啦啦19 小时前
ubuntu服务器版启动卡在start job is running for wait for...to be Configured
linux·运维·ubuntu
子非衣1 天前
Ubuntu系统挂载磁盘并配置开机自动挂载
linux·运维·ubuntu
ChironW1 天前
Ubuntu 22.04.5 LTS上部署Docker及相关优化
ubuntu·docker·容器
richer_20201 天前
双系统重装ubuntu
linux·运维·ubuntu
微学AI1 天前
用FileCodeBox打造私有文件传输:Ubuntu环境保姆级部署教程!
linux·运维·ubuntu
松树戈1 天前
本地 PC 使用Offset Explorer连接实体Ubuntu Kafka 【单机】超时问题解决
linux·ubuntu·kafka
云途行者1 天前
windows、Ubuntu、Debian 添加静态路由
linux·windows·ubuntu