Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the multiple definitions of lexical casts methods #1281

Conversation

saikishor
Copy link
Member

Fixes the issue caused in the PR : ros-controls/ros2_control_demos#428

When you have multiple files using the lexical casts header and they create the same library/executable, they show this multiple definitions error

--- stderr: ros2_control_demo_example_14
/usr/bin/ld: CMakeFiles/ros2_control_demo_example_14.dir/hardware/rrbot_sensor_for_position_feedback.cpp.o: in function `hardware_interface::stod(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
rrbot_sensor_for_position_feedback.cpp:(.text+0x3a): multiple definition of `hardware_interface::stod(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'; CMakeFiles/ros2_control_demo_example_14.dir/hardware/rrbot_actuator_without_feedback.cpp.o:rrbot_actuator_without_feedback.cpp:(.text+0xb): first defined here
/usr/bin/ld: CMakeFiles/ros2_control_demo_example_14.dir/hardware/rrbot_sensor_for_position_feedback.cpp.o: in function `hardware_interface::parse_bool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
rrbot_sensor_for_position_feedback.cpp:(.text+0x1cb): multiple definition of `hardware_interface::parse_bool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'; CMakeFiles/ros2_control_demo_example_14.dir/hardware/rrbot_actuator_without_feedback.cpp.o:rrbot_actuator_without_feedback.cpp:(.text+0x19c): first defined here
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/ros2_control_demo_example_14.dir/build.make:257: libros2_control_demo_example_14.so] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:137: CMakeFiles/ros2_control_demo_example_14.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
```

Copy link

codecov bot commented Jan 9, 2024

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (2d82de8) 47.89% compared to head (474d424) 47.87%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1281      +/-   ##
==========================================
- Coverage   47.89%   47.87%   -0.03%     
==========================================
  Files          41       41              
  Lines        3451     3453       +2     
  Branches     1876     1878       +2     
==========================================
  Hits         1653     1653              
  Misses        444      444              
- Partials     1354     1356       +2     
Flag Coverage Δ
unittests 47.87% <29.41%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...controller_interface/controller_interface_base.hpp 33.33% <ø> (ø)
.../include/controller_manager/controller_manager.hpp 18.18% <ø> (ø)
...roller_interface/src/controller_interface_base.cpp 48.14% <0.00%> (ø)
controller_manager/src/controller_manager.cpp 39.15% <16.66%> (-0.07%) ⬇️
hardware_interface/src/lexical_casts.cpp 40.00% <40.00%> (ø)

@bmagyar bmagyar added backport-humble This label should be used by maintaines only! Label triggers PR backport to ROS2 humble. backport-iron This label should be used by maintaines only! Label triggers PR backport to ROS2 Iron. labels Jan 9, 2024
@bmagyar bmagyar merged commit 71506d5 into ros-controls:master Jan 9, 2024
14 checks passed
mergify bot pushed a commit that referenced this pull request Jan 9, 2024
mergify bot pushed a commit that referenced this pull request Jan 9, 2024
@saikishor saikishor deleted the fix_multiple_definitions_of_lexical_casts branch August 17, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-humble This label should be used by maintaines only! Label triggers PR backport to ROS2 humble. backport-iron This label should be used by maintaines only! Label triggers PR backport to ROS2 Iron.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants