ros-drivers / transport_drivers

A set of ROS2 drivers for transport-layer protocols.
Apache License 2.0
93 stars 56 forks source link

Windows Build #81

Open genevanmeter opened 2 years ago

genevanmeter commented 2 years ago

https://github.com/ros-drivers/transport_drivers/compare/main...genevanmeter:transport_drivers:Windows

I made a few changes to build for Windows and Humble (see above link) While it appears to be working I'm not confident it's the "proper" ROS way to do it. Originally I attempted use the visibility_control.hpp documented here but was unsuccessful.

hassanshahid520 commented 1 year ago

Hi, I tried to build this in WIN 10, VS2019, v142 build tools and tried with both officially provided ros2 binaries for win10 and built from source as well. But this error occurs with udp_driver package, have you faced this before

  udp_receiver_node.cpp
  udp_sender_node.cpp
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(53,5): error C2143: syntax error: missing '}' before 'constant' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(53,5): error C2059: syntax error: 'constant' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(54,3): error C2143: syntax error: missing ';' before '}' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(54,3): error C2238: unexpected token(s) preceding ';' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(62,15): error C2433: 'CallbackReturn': 'virtual' not permitted on data declarations (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(62,3): error C2146: syntax error: missing ';' before identifier 'on_configure' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(70,13): error C2433: 'CallbackReturn': 'virtual' not permitted on data declarations (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(70,3): error C2146: syntax error: missing ';' before identifier 'on_cleanup' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(78,14): error C2433: 'CallbackReturn': 'virtual' not permitted on data declarations (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(78,3): error C2146: syntax error: missing ';' before identifier 'on_shutdown' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(86,14): error C2433: 'CallbackReturn': 'virtual' not permitted on data declarations (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(86,3): error C2146: syntax error: missing ';' before identifier 'on_activate' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(94,16): error C2433: 'CallbackReturn': 'virtual' not permitted on data declarations (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(94,3): error C2146: syntax error: missing ';' before identifier 'on_deactivate' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(102,11): error C2433: 'CallbackReturn': 'virtual' not permitted on data declarations (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(102,3): error C2146: syntax error: missing ';' before identifier 'on_error' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(106,26): error C2588: '::~LifecycleNodeInterface': illegal global destructor (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(106,4): error C2575: 'LifecycleNodeInterface': only member functions and bases can be virtual (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(106,29): error C2491: 'rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface': definition of dllimport function not allowed (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(110,1): error C2059: syntax error: '}' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(110,1): error C2143: syntax error: missing ';' before '}' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/managed_entity.hpp(23,1): error C2143: syntax error: missing ';' before '{' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/managed_entity.hpp(23,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/lifecycle_node.hpp(122,69): error C2516: 'rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface': is not a legal base class (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(106): message : see declaration of 'rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/lifecycle_node.hpp(789,36): error C2653: 'LifecycleNodeInterface': is not a class or namespace name (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/lifecycle_node.hpp(789,60): error C2061: syntax error: identifier 'CallbackReturn' (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
D:/install/include/rclcpp_lifecycle\rclcpp_lifecycle/lifecycle_node.hpp(788,3): error C2535: 'const rclcpp_lifecycle::State &rclcpp_lifecycle::LifecycleNode::trigger_transition(const rclcpp_lifecycle::Transition &)': member function already defined or declared (compiling source file E:\work_vresolv\test\transport_drivers\udp_driver\src\udp_sender_node.cpp) [E:\work_vresolv\test\build\udp_driver\udp_driver_nodes.vcxproj]
hassanshahid520 commented 1 year ago

The problem was that the symbol ERROR was defined somewhere in windows c++ libraries which was clashing with ERROR defined in rclcpp_lifecycle\rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp(53,5): .

Adding

#ifdef ERROR
#undef ERROR
#endif

after the include files of c++ solved the issue.