If this isn't the solution to the std::variant build error, can someone please point me in the direction of the solution?. Why didn't setting it via -DCMAKE_CXX_FLAGS='-std=c++17' work?.How do you force colcon to use a specific C++ standard?.However, I would rather not have to change the CMakeList files of all the packages in my codebase, and I'm pretty sure that changing the version via colcon build should have worked. I know that I _can_ force individual packages to compile with a specific version using this code snippet in the CMakeList file: if(NOT CMAKE_CXX_STANDARD) However this doesn't appear to work as I get the same error. I couldn't find any reference to "CXX" or "C++" versions in the colcon documentation either, but through colcon build help figured out that the following command should in _theory_ set the C++ version: $ colcon build -cmake-args -DCMAKE_CXX_FLAGS='-std=c++17' This also doesn't appear to be a known issue with rclcpp ( see the issue tracker) I'm surprised by this as there are a a few posts around the place suggesting that Galactic requires C++17 ( see here) but I couldn't find any reference to this on the Galactic release page. This error doesn't reference any of my code directly, and seems to indicate that the rclcpp package in Galactic is failing to compile because C++17 isn't being used. opt/ros/galactic/include/rclcpp/any_subscription_callback.hpp:81:24: note: ‘std::variant’ is only available from C++17 onwards But when I run colcon build I get a nebulous error that suggests the problem is that a pre-C++17 standard is being used: /opt/ros/galactic/include/rclcpp/any_subscription_callback.hpp:81:29: error: ‘variant’ in namespace ‘std’ does not name a I want to compile my ROS2 code using Galactic (not Foxy) so I have made sure that I have sourced only the setup file for that distro. I am currently encountering a problem whilst compiling on a Ubuntu 20 system, with ROS Galactic and ROS2 Foxy both installed. How do I run colcon build with the C++ version set specifically to 17, and without having to manually edit every CMakeList file in my system? Problem (in detail)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |