Unable to build package with custom interfaces

Hello,

I am trying to create a template for packages that contain custom interfaces. I created this one, where I created some custom messages and services. In one of the messages and one of the services, I use example_interfaces/Int64MultiArray just to show that it is possible to use other messages in your custom interfaces. But the build fails with this error:

fatal error: example_interfaces/msg/detail/int64_multi_array__struct.hpp: No such file or directory
   20 | #include "example_interfaces/msg/detail/int64_multi_array__struct.hpp"

I tried with different messages from the example_interfaces package as well as the geometry_msgs package and had the same result.

Could someone please look at the package and tell me what I am doing wrong? Thanks!

Hi @envilon ,

I just saw your repo.

In your CMakeLists.txt file, you have not included geometry_msgs.

The way you have declared Int64MultiArray is wrong (I believe so).
It must be example_interfaces/Int64MultiArray[] values.

Try these changes and let me know if they worked for you.

Regards,
Girish

Hello @girishkumar.kannan,

thank you for your quick reply, but unfortunately, I believe your suggestions are irrelevant.

I do not use geometry_msgs anywhere in the package so there is no need to include it in CMakeList.txt. In my post, I just clarified that before posting on the forum, I tested this with different messages and packages and observed the same issue; not that the package is using geometry_msgs at the moment.

This has nothing to do with the error message or with the issue. Your suggestion would only change my example_interfaces/Int64MultiArray field into an unbounded array of example_interfaces/Int64MultiArrays. The problem would persist.

Hi @envilon ,

  1. I thought you wanted to use geometry_msgs, therefore I thought you should include that in your CMakeLists. I could still see geometry_msgs in your package.xml.
  2. About that [] in the multi array, I realized this later, forgot to edit this in my post.

I hope I did not mislead you too much.

Try this step: In your CMakeLists.txt add this line

rosidl_generate_interfaces(${PROJECT_NAME}
  ${msg_files}
  ${srv_files}
  DEPENDENCIES example_interfaces   <--- add this line here
)

Regards,
Girish

1 Like

Thank you, @girishkumar.kannan, that solved the issue.

1 Like

Hi @envilon ,

Glad to know that worked for you.

Just for your information, this step is specified in the ROS2 documentation.
Refer: Implementing custom interfaces — ROS 2 Documentation: Humble documentation

Regards,
Girish

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.