catkin_make 编译找不到头文件

在使用catkin_make编译代码时,出现错误如下

/home/hx/WorkSpace/topic_ws/src/learning_topic/src/pose_subscriber.cpp:13:10: fatal error: pcl/io/pcd_io.h: 没有那个文件或目录
 #include <pcl/io/pcd_io.h>

 1.首先确认头文件是否存在

2.如果文件不存在,。。。。那就去找吧,如果存在此文件,找到文件路径,并在VSCode中c_cpp_properties.json中,添加这个头文件路径

 3。这个时候VScode中不会出现红色的波浪线了,但是使用catkin_make还是会报错

4.修改 CMakeList.txt的内容,如下

###################################

## catkin specific configuration ##

###################################

## The catkin_package macro generates cmake config files for your package

## Declare things to be passed to dependent projects

## INCLUDE_DIRS: uncomment this if your package contains header files

## LIBRARIES: libraries you create in this project that dependent projects also need

## CATKIN_DEPENDS: catkin_packages dependent projects also need

## DEPENDS: system dependencies of this project that dependent projects also need

catkin_package(

INCLUDE_DIRS include

LIBRARIES learning_topic

# CATKIN_DEPENDS geometry_msgs roscpp rospy std_msgs turtlesim

# DEPENDS system_lib

)

###########

## Build ##

###########

## Specify additional locations of header files

## Your package locations should be listed before other locations

include_directories(

include

${catkin_INCLUDE_DIRS}

include /usr/include/pcl-1.8/

include /usr/include/eigen3/

)

再将头文件路径,放在include_directories中,然后再编译 

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值