Scanning dependencies of target test1
[ 10%] Building CXX object CMakeFiles/test1.dir/src/filter.cpp.o
/home/zth/Projects/PCReg/src/filter.cpp:19:6: error: default argument given for parameter 3 of ‘void voxel_filter(pcl::PointCloud<pcl::PointXYZ>::Ptr&, pcl::PointCloud<pcl::PointXYZ>::Ptr&, float)’ [-fpermissive]
19 | void voxel_filter(pcl::PointCloud<PointT>::Ptr &cloud, pcl::PointCloud<PointT>::Ptr &cloud_filtered, float leaf_size = 1.0f) {
| ^~~~~~~~~~~~
In file included from /home/zth/Projects/PCReg/src/filter.cpp:8:
/home/zth/Projects/PCReg/include/filters.h:15:6: note: previous specification in ‘void voxel_filter(pcl::PointCloud<pcl::PointXYZ>::Ptr&, pcl::PointCloud<pcl::PointXYZ>::Ptr&, float)’ here
15 | void voxel_filter(pcl::PointCloud<PointT>::Ptr &cloud, pcl::PointCloud<PointT>::Ptr &cloud_filtered, float leaf_size = 1.0f);
| ^~~~~~~~~~~~
make[2]: *** [CMakeFiles/test1.dir/build.make:102: CMakeFiles/test1.dir/src/filter.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/test1.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
解决方法
C++ 在声明函数时不可以给形参默认值,在定义函数时可以给默认值。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)