mich1342/ros2_laser_scan_merger

error: call of overloaded ‘PointXYZRGB(int&, int&, int&)’ is ambiguous

FilippoGuarda opened this issue · 3 comments

Currently working with ROS2 Humble on Ubuntu 22.04,
When building the following error pops up several times for different lines in the code:

src/ros2_laser_scan_merger/src/main.cpp:133:67: error: call of overloaded ‘PointXYZRGB(int&, int&, int&)’ is ambiguous
  133 |                 pt = pcl::PointXYZRGB(laser1R_, laser1G_, laser1B_);
      |                                                                   ^
In file included from /usr/include/pcl-1.12/pcl/point_types.h:354,
                 from /usr/include/pcl-1.12/pcl/common/impl/copy_point.hpp:40,
                 from /usr/include/pcl-1.12/pcl/common/copy_point.h:58,
                 from /usr/include/pcl-1.12/pcl/common/impl/io.hpp:45,
                 from /usr/include/pcl-1.12/pcl/common/io.h:538,
                 from /usr/include/pcl-1.12/pcl/io/impl/pcd_io.hpp:48,
                 from /usr/include/pcl-1.12/pcl/io/pcd_io.h:789,
                 from /opt/ros/humble/include/pcl_conversions/pcl_conversions.h:72,
                 from /home/watch/Documents/GD_recharge_station/src/ros2_laser_scan_merger/src/main.cpp:10:
/usr/include/pcl-1.12/pcl/impl/point_types.hpp:687:12: note: candidate: ‘pcl::PointXYZRGB::PointXYZRGB(float, float, float)’
  687 |     inline PointXYZRGB (float _x, float _y, float _z):
      |            ^~~~~~~~~~~
/usr/include/pcl-1.12/pcl/impl/point_types.hpp:684:12: note: candidate: ‘pcl::PointXYZRGB::PointXYZRGB(uint8_t, uint8_t, uint8_t)’
  684 |     inline PointXYZRGB (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
      |            ^~~~~~~~~~~

I suspect something may have happened with an updated dependency, but at the time I do not understand the code well enough to make any precise guess.

Hi @FilippoGuarda

From what I see, the newer version requires uint8_t instead of int.

You could try to modify line 411 and 414 from int into uint8_t.

I will need some times to setup a VM to match your version. I will test it and make a new commit based on this issues

Thank you.

Best Regards

Michael

Thank you for the @mich1342,

changing int to uint8_t in lines 411, 414, 390-392 and 401-403 seems to have solved the issue.

Colcon still outputs quite a lot of warnings related to ISO C++ during the building process, but they seem related to a third party library, pcl to be precise.
Here is an example:

In file included from /usr/include/pcl-1.12/pcl/point_types.h:354,
                 from /usr/include/pcl-1.12/pcl/common/impl/copy_point.hpp:40,
                 from /usr/include/pcl-1.12/pcl/common/copy_point.h:58,
                 from /usr/include/pcl-1.12/pcl/common/impl/io.hpp:45,
                 from /usr/include/pcl-1.12/pcl/common/io.h:538,
                 from /usr/include/pcl-1.12/pcl/io/impl/pcd_io.hpp:48,
                 from /usr/include/pcl-1.12/pcl/io/pcd_io.h:789,
                 from /opt/ros/humble/include/pcl_conversions/pcl_conversions.h:72,
                 from /home/watch/Documents/GD_recharge_station/src/ros2_laser_scan_merger/src/main.cpp:10:
/usr/include/pcl-1.12/pcl/impl/point_types.hpp:241:12: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
  241 |     struct { \
      |            ^

I'm pretty sure this secondary issue does not have anything to do with laser_scan_merger but maybe with some change relative to C++, I'm still trying to wrap my head around it.

UPDATE:

The general advice seems to just ignore it if building on linux, may cause some problems with windows SDK.

I'm sending a pull request with the changes

Hi @FilippoGuarda

Thank you for your feedback.

Sure I will accept your pull request after migrating current main branch into foxy so that current main branch is dedicated for humble.

I also found the C++ ISO problems due to the PCL libraries. It does not cause any error and only shows warning up until now.

I have not have any luck running ROS2 on Windows up until now. Thanks for the advice. I will try to look on it.

Best Regards

Michael