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

note: ‘std::optional’ is only available from C++17 onwards #31

Open
Ac31415 opened this issue Apr 5, 2021 · 5 comments
Open

note: ‘std::optional’ is only available from C++17 onwards #31

Ac31415 opened this issue Apr 5, 2021 · 5 comments

Comments

@Ac31415
Copy link

Ac31415 commented Apr 5, 2021

Good day, I've tried to compile plankton as instructed but got the following error:

--- stderr: uuv_world_plugins In file included from /usr/include/ignition/math6/ignition/math.hh:30, from /usr/include/sdformat-9.4/sdf/Param.hh:33, from /usr/include/sdformat-9.4/sdf/Element.hh:28, from /usr/include/sdformat-9.4/sdf/Actor.hh:25, from /usr/include/sdformat-9.4/sdf/sdf.hh:2, from /usr/include/gazebo-11/gazebo/common/Battery.hh:25, from /usr/include/gazebo-11/gazebo/common/common.hh:8, from /usr/include/gazebo-11/gazebo/gazebo_core.hh:19, from /usr/include/gazebo-11/gazebo/gazebo.hh:20, from /home/wen-chung/colcon_ws/src/Plankton/uuv_world_plugins/uuv_world_plugins/include/uuv_world_plugins/GaussMarkovProcess.h:28, from /home/wen-chung/colcon_ws/src/Plankton/uuv_world_plugins/uuv_world_plugins/src/GaussMarkovProcess.cpp:24: /usr/include/ignition/math6/ignition/math/Capsule.hh:91:20: error: ‘optional’ in namespace ‘std’ does not name a template type 91 | public: std::optional< MassMatrix3<Precision> > MassMatrix() const; | ^~~~~~~~ /usr/include/ignition/math6/ignition/math/Capsule.hh:91:15: note: ‘std::optional’ is only available from C++17 onwards 91 | public: std::optional< MassMatrix3<Precision> > MassMatrix() const; | ^~~

How do I resolve this? Is there a way to change my c++ version using colcon compiler?

Thanks,
Andy Cheng

@jpliquid
Copy link
Collaborator

jpliquid commented Apr 6, 2021

Hi @Ac31415,

Apparently, the recently added Capsule.hh file in Ignition requires C++17.

Could you try opening CMakeLists.txt in uuv_world_plugins folder and replacing the line set(CMAKE_CXX_STANDARD 14) with set(CMAKE_CXX_STANDARD 17) ? Let me know if it fixes the problem.

@Ac31415
Copy link
Author

Ac31415 commented Apr 6, 2021

Hi @jpliquid ,

Thanks for your prompt response! The above issues have been resolved. However, another error pops up with uuv_sensor_ros_plugins:

--- stderr: uuv_sensor_ros_plugins /home/wen-chung/colcon_ws/src/Plankton/uuv_sensor_plugins/uuv_sensor_ros_plugins/src/DVLROSPlugin.cpp: In member function ‘virtual void gazebo::DVLROSPlugin::Load(gazebo::physics::ModelPtr, sdf::v9::ElementPtr)’: /home/wen-chung/colcon_ws/src/Plankton/uuv_sensor_plugins/uuv_sensor_ros_plugins/src/DVLROSPlugin.cpp:49:60: error: no matching function for call to ‘tf2_ros::Buffer::Buffer(rclcpp::Clock::SharedPtr)’ 49 | myBuffer.reset(new tf2_ros::Buffer(myRosNode->get_clock())); | ^ In file included from /opt/ros/noetic/include/tf2_ros/transform_listener.h:40, from /home/wen-chung/colcon_ws/src/Plankton/uuv_sensor_plugins/uuv_sensor_ros_plugins/include/uuv_sensor_ros_plugins/ROSBaseModelPlugin.h:37, from /home/wen-chung/colcon_ws/src/Plankton/uuv_sensor_plugins/uuv_sensor_ros_plugins/include/uuv_sensor_ros_plugins/DVLROSPlugin.h:35, from /home/wen-chung/colcon_ws/src/Plankton/uuv_sensor_plugins/uuv_sensor_ros_plugins/src/DVLROSPlugin.cpp:22: /opt/ros/noetic/include/tf2_ros/buffer.h:63:5: note: candidate: ‘tf2_ros::Buffer::Buffer(ros::Duration, bool)’ 63 | Buffer(ros::Duration cache_time = ros::Duration(BufferCore::DEFAULT_CACHE_TIME), bool debug = false); | ^~~~~~ /opt/ros/noetic/include/tf2_ros/buffer.h:63:26: note: no known conversion for argument 1 from ‘rclcpp::Clock::SharedPtr’ {aka ‘std::shared_ptr<rclcpp::Clock>’} to ‘ros::Duration’ 63 | Buffer(ros::Duration cache_time = ros::Duration(BufferCore::DEFAULT_CACHE_TIME), bool debug = false); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Does this have something to do with the multiple ROS installed in my system?

@Ac31415
Copy link
Author

Ac31415 commented Apr 12, 2021

@jpliquid Any updates?

@jpliquid
Copy link
Collaborator

@Ac31415 You are fine to have multiple versions of ROS installed on your system, but the error shows that colcon uses Noetic instead of Foxy. Have you correctly sourced your Foxy distribution as indicated here before building Plankton ?

@Ac31415
Copy link
Author

Ac31415 commented Apr 13, 2021

Yes I did. And it still recognized Noetic as the current distribution of ROS. So I actually resolved it by uninstalling both distributions of ROS, and then just reinstall ROS2 (Foxy) afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants