RoboSense-LiDAR / ros_rslidar

ROS drvier for RS-LiDAR-16 and RS-LiDAR-32
Other
170 stars 116 forks source link

Point Cloud Library 1.10 requires C++14 standard #49

Open duncanmcbryde opened 3 years ago

duncanmcbryde commented 3 years ago

OS: Ubuntu 20.04 ROS: Melodic

Crashes on compile, because the point cloud library needs C++ 14 standard, and this is compiled with C++ 11.

In file included from /usr/include/pcl-1.10/pcl/pcl_macros.h:77,
                 from /usr/include/pcl-1.10/pcl/point_types.h:42,
                 from /home/duncan/catkin_ws/src/ros_rslidar/rslidar_driver/src/rsdriver.h:23,
                 from /home/duncan/catkin_ws/src/ros_rslidar/rslidar_driver/src/rsdriver.cpp:12:
/usr/include/pcl-1.10/pcl/pcl_config.h:7:4: error: #error PCL requires C++14 or above
    7 |   #error PCL requires C++14 or above
      |    ^~~~~

Many compile errors follow.

/usr/include/pcl-1.10/pcl/common/io.h:65:9: note:   no known conversion for argument 1 from ‘const pcl::PCLPointField’ to ‘int’
make[2]: *** [ros_rslidar/rslidar_driver/src/CMakeFiles/rslidar_driver.dir/build.make:63: ros_rslidar/rslidar_driver/src/CMakeFiles/rslidar_driver.dir/rsdriver.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3405: ros_rslidar/rslidar_driver/src/CMakeFiles/rslidar_driver.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Invoking "make -j1 -l1" failed

This can be fixed by changing the C++ standard.

Edit rslidar_driver/CMakeLists.txt and rslidar_pointcloud/CMakeLists.txt and change the line

add_compile_options(-std=c++11)

to

add_compile_options(-std=c++14)

for each file.

Similar to issue in rslidar_sdk https://github.com/RoboSense-LiDAR/rslidar_sdk/issues/2

duncanmcbryde commented 3 years ago

Looks like pull #43 also fixes this issue.