操作系统:ros(indigo)/ubuntu14.04
编译工具:cmake(catkin_make)
出现错误:
robot_control/src/robot_control.cpp:9:62: fatal error: robot_control/robot_control.h: No such file or directory
#include<robot_control/robot_control.h>
出现此错误时,有三种可能情况:
1. 此.h文件是由自定义消息生成的,如robot_msgs/voltage.msg
则解决方法是cmakeList中添加:
add_executable(robot_control_node src/robot_control.cpp )
add_dependencies(robot_control_node robot_msgs_gencpp)
target_link_libraries(robot_control_node ${catkin_LIBRARIES})
其中:robot_control_node是所要生成的可执行文件,add_dependencies添加所需依赖。
请记得,在find_package中添加robot_msgs。
其次,请记得在package.xml中添加
<build_depend>robot_msgs</build_depend>
<run_depend>robot_msgs</run_depend>
2. 此.h文件位于本包include内:
解决方法是,在包含目录下包含include包:
include_directories(
include
${catkin_INCLUDE_DIRS}
)
3. 此.h文件位于别的包内,如robot_navigation:
则在find_package中添加此包名:
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
robot_navigation
)
其次,请记得在package.xml中添加
<build_depend>robot_navigation</build_depend>
<run_depend>robot_navigation</run_depend>
欢迎大家批评,指正,交流!
(ros/catkin) ××/××.h: No such file or directory
原文地址:http://blog.csdn.net/w383117613/article/details/46049273