felixendres / rgbdslam_v2

RGB-D SLAM for ROS
GNU General Public License v3.0
947 stars 399 forks source link

Ubuntu 18.04 and ROS Melodic compile error.Error: call of overloaded ‘round(float)’ is ambiguous #100

Open a4zhangfei opened 5 years ago

a4zhangfei commented 5 years ago

error: ‘int round(float)’ conflicts with a previous declaration inline int round(float d) ^ In file included from /opt/ros/melodic/include/ros/time.h:55:0, from /opt/ros/melodic/include/ros/ros.h:38, from /home/zhangzhihao/kinetic_rgbdslam_catkin_ws/src/kinetic_slam/src/misc.cpp:16: /usr/include/c++/7/cmath:1771:3: note: previous declaration ‘constexpr float std::round(float)’ round(float x) ^~~~~ /home/zhangzhihao/kinetic_rgbdslam_catkin_ws/src/kinetic_slam/src/misc.cpp: In function ‘void observationLikelihood(const Matrix4f&, pcl::PointCloud::Ptr, pcl::PointCloud::Ptr, const CameraInfo&, double&, double&, unsigned int&, unsigned int&, unsigned int&, unsigned int&)’: /home/zhangzhihao/kinetic_rgbdslam_catkin_ws/src/kinetic_slam/src/misc.cpp:880:53: error: call of overloaded ‘round(float)’ is ambiguous int old_rx_center = round((p.x / p.z)* fx + cx); ^ In file included from /usr/include/features.h:424:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:533, from /usr/include/c++/7/cstdlib:41, from /usr/include/c++/7/stdlib.h:36, from /opt/ros/melodic/include/ros/platform.h:53, from /opt/ros/melodic/include/ros/time.h:53, from /opt/ros/melodic/include/ros/ros.h:38, from /home/zhangzhihao/kinetic_rgbdslam_catkin_ws/src/kinetic_slam/src/misc.cpp:16: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:298:1: note: candidate: double round(double) MATHCALLX (round,, (Mdouble x), (const)); ^ In file included from /opt/ros/melodic/include/ros/time.h:55:0, from /opt/ros/melodic/include/ros/ros.h:38, from /home/zhangzhihao/kinetic_rgbdslam_catkin_ws/src/kinetic_slam/src/misc.cpp:16: /usr/include/c++/7/cmath:1771:3: note: candidate: constexpr float std::round(float) round(float x) ^~~~~ /usr/include/c++/7/cmath:1775:3: note: candidate: constexpr long double std::round(long double) round(long double __x) ^~~~~ /home/zhangzhihao/kinetic_rgbdslam_catkin_ws/src/kinetic_slam/src/misc.cpp:804:12: note: candidate: int round(float) inline int round(float d) ^~~~~ /home/zhangzhihao/kinetic_rgbdslam_catkin_ws/src/kinetic_slam/src/misc.cpp:881:53: error: call of overloaded ‘round(float)’ is ambiguous int old_ry_center = round((p.y / p.z)* fy + cy); ^

Magical-E commented 5 years ago

Hello,I meet the same error in Ubuntu 18.04 .Have you already solved it?

a4zhangfei commented 5 years ago

I changed the Ubuntu version: 16.04

------------------ 原始邮件 ------------------ 发件人: "Magical-E"notifications@github.com; 发送时间: 2019年7月24日(星期三) 上午10:28 收件人: "felixendres/rgbdslam_v2"rgbdslam_v2@noreply.github.com; 抄送: "a4zhangfei"1617315424@qq.com; "Author"author@noreply.github.com; 主题: Re: [felixendres/rgbdslam_v2] Ubuntu 18.04 and ROS Melodic compile error.Error: call of overloaded ‘round(float)’ is ambiguous (#100)

Hello,I meet the same error in Ubuntu 18.04 .Have you already solved it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

ideechaniz commented 4 years ago

I have the same problem under debian 10 and ros melodic

QianYC commented 4 years ago

there is an inline function named "round" in misc.cpp, you can solve this problem by simply rename the function and the revoke to anything like "myround"