ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Rosidl unresolved external symbol issue when creating a publisher using the custom msg.

asked 2019-04-04 05:36:06 -0600

Mr. Nobody gravatar image

updated 2019-04-05 12:38:51 -0600

I am able to build rosidl custom msgs using ROS2 crystal (Windows).

But when I am trying to build an executable using even default rosidl custom msgs (Say String.msg), I am getting unresolved external symbols issue.

I have added all the libs generated inside rosidl build folder. If anybody can help, what mistake I am doing, that would be helpful. Thanks for your time in advance. Here is the error.

error LNK2001: unresolved external symbol "struct rosidl_message_type_support_t const * __cdecl rosidl_typesupport_cpp::get_message_type_support_handle<struct rosidl_generator_cpp::msg::String_<class std::allocator<void> > >(void)" (??$get_message_type_support_handle@U?$String_@V?$allocator@X@std@@@msg@rosidl_generator_cpp@@@rosidl_typesupport_cpp@@YAPEBUrosidl_message_type_support_t@@XZ)
edit retag flag offensive close merge delete

Comments

Without more information it's hard to provide assistance, please consider providing your CMakeLists.txt.

If I had to guess, you may be missing a ament_target_dependencies call in your CMake. You can see https://github.com/ros2/examples/blob... for a simple example of how to use messages in an executable

marguedas gravatar image marguedas  ( 2019-04-04 07:33:00 -0600 )edit

I am not using CMakeList to build the exe. I have created my own Visual Studio Project where I am able to build executable with Std_Msgs but facing this issue while building custom msgs. I have added all the necessary rosidl libs in visual studio properties. But still getting the above mentioned error.

Mr. Nobody gravatar image Mr. Nobody  ( 2019-04-05 01:34:06 -0600 )edit

What is the difference between the project building std_msgs and your custom messages? Are the included libraries exactly the same? Do your custom messages depend on other message packages (like std_msgs)? If so you'll need to include the libraries of the dependencies as well.

marguedas gravatar image marguedas  ( 2019-04-05 05:31:13 -0600 )edit

Actually, What I am doing is , I am trying to create a publisher like this, and I am facing the issue :

auto publisher = node->create_publisher<rosidl_generator_cpp::msg::string>("CM_TO_DLL");

Same like this for Std_msgs , publisher is working , for example :

auto publisher = node->create_publisher<std_msgs::msg::float32>("CM_TO_DLL");

I added all the necessary libs, as per my understanding, which were getting generated after building rosidl package using colcon build.

By the way, Thanks for investing your time in trying to understand my issue.

Mr. Nobody gravatar image Mr. Nobody  ( 2019-04-05 06:46:44 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-04-05 08:13:38 -0600

marguedas gravatar image

rosidl_generator_cpp::msg::string is not a message type meant to be used by downstream users. It is just a local message type used for testing the c++ message generator, the corresponding library doesn't get installed on the system: https://github.com/ros2/rosidl/blob/4...

The messages installed on your system can be listed with ros2 msg list. You can either use existing messages (like std_msgs/String) or create your own.

edit flag offensive delete link more

Comments

I am not able to comprehend your answer completely. Could you please guide me to an example for windows machine where I can publish using ros2 custom msg in crystal.

I am aware of ROS2 custom msgs. I was using custom msgs same way for ardent as I mentioned above in my comments using these tutorials(Link is given below) but not able to build them using colcon build in crystal.

https://github.com/ros2/tutorials/tre...

So I thought of using rosidl package to use custom msgs but failed to do so. My intention is to publish using a custom msg for crystal in a windows machine.

Mr. Nobody gravatar image Mr. Nobody  ( 2019-04-05 12:21:43 -0600 )edit

Question Tools

Stats

Asked: 2019-04-04 05:36:06 -0600

Seen: 1,441 times

Last updated: Apr 05 '19