0
$\begingroup$

Rosanswers logo

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)

Originally posted by Mr. Nobody on ROS Answers with karma: 1 on 2019-04-04

Post score: 0


Original comments

Comment by marguedas on 2019-04-04:
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/54a8b188a3dcb4cdee38833767cc682a276bf805/rclcpp/minimal_publisher/CMakeLists.txt#L17 for a simple example of how to use messages in an executable

Comment by Mr. Nobody on 2019-04-05:
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.

Comment by marguedas on 2019-04-05:
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.

Comment by Mr. Nobody on 2019-04-05:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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/4d9f442853dfaa7a2480489b0c1bb9285da7ba53/rosidl_generator_cpp/CMakeLists.txt#L72

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.


Originally posted by marguedas with karma: 3606 on 2019-04-05

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Mr. Nobody on 2019-04-05:
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/tree/rosidl_tutorials/rosidl_tutorials

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.