0

Hi i am currently trying to create a custom message for an exisitng package however i create Point_id.msg but when i included it as a header file in my code, i receive the following error

/home/111/222/333/find_object_2d/src/objects_detected.cpp:7:41: fatal error:       
find_object_2d/PointObjects.h: No such file or directory
compilation terminated.
make[2]: *** [find_object_2d/CMakeFiles/objects_detected.dir/src/objects_detected.cpp.o] Error 1
make[1]: *** [find_object_2d/CMakeFiles/objects_detected.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed

This is what i included in Point_id.msg :

int16 id
geometry_msgs/Point punto

This is my include header in the codes:

#include <find_object_2d/PointObjects.h>
#include <find_object_2d/Point_id.h

In the existing cmakelist.txt there was no sign of # rosbuild_gensrv() so should i create a new package within the existing package and create the .msg files in the src folder and try to build it? or what should i do? i'm really confused.

Please help thank you!

WinnePoon
  • 1
  • 3

1 Answers1

0

You have to modify the CMakeLists.txt of the package a bit, otherwise the *.h files will not be generated.

If you use rosmake:

Simply add rosbuild_genmsg() to CMakeLists.txt

If you use catkin:

With catkin it is a bit more complicated:

Add "message_generation" to find_package(catkin REQUIRED COMPONENTS ... and

add_message_files(
  FILES
  Point_id.msg
)
generate_messages(
  DEPENDENCIES
  geometry_msgs
)

I hope, this helps.

luator
  • 4,769
  • 3
  • 30
  • 51