“flann”: 不明确的符号

在整合PCL与OpenCV时,由于两者都包含flann库,造成命名空间冲突,引发编译错误。解决方法包括:移除'using namespace cv;',改用'cv::'前缀;或调整库引用顺序,先引用PCL库再引用OpenCV库。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在同时使用PCL和OpenCV库的时候,由于两个库中都包含了flann库,会重复出现flann命名空间,导致编译报错,

目前知道了两种解决方法:

将代码“using namespace cv;”删除,使用“cv::anything”,这样就不会直接出现cv::flann,导致和PCL中的flann冲突;

将引用PCL库的语句放在引用OpenCV库的前面。
 

[100%] Built target ego_planner_node /usr/bin/ld: CMakeFiles/random_forest.dir/src/random_forest_sensing.cpp.o: in function `RandomMapGenerate()': /home/dxinl/Fast-Drone-250/src/uav_simulator/map_generator/src/random_forest_sensing.cpp:152: undefined reference to `pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::setInputCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZ> const> const&, boost::shared_ptr<std::vector<int, std::allocator<int> > const> const&)' /usr/bin/ld: CMakeFiles/random_forest.dir/src/random_forest_sensing.cpp.o: in function `RandomMapGenerateCylinder()': /home/dxinl/Fast-Drone-250/src/uav_simulator/map_generator/src/random_forest_sensing.cpp:269: undefined reference to `pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::setInputCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZ> const> const&, boost::shared_ptr<std::vector<int, std::allocator<int> > const> const&)' /usr/bin/ld: CMakeFiles/random_forest.dir/src/random_forest_sensing.cpp.o:(.data.rel.ro._ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE[_ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE]+0x10): undefined reference to `pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::setInputCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZ> const> const&, boost::shared_ptr<std::vector<int, std::allocator<int> > const> const&)' /usr/bin/ld: CMakeFiles/random_forest.dir/src/random_forest_sensing.cpp.o:(.data.rel.ro._ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE[_ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE]+0x28): undefined reference to `pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::nearestKSearch(pcl::PointXYZ const&, int, std::vector<int, std::allocator<int> >&, std::vector<float, std::allocator<float> >&) const' collect2: error: ld returned 1 exit status make[2]: *** [uav_simulator/map_generator/CMakeFiles/random_forest.dir/build.make:329:/home/dxinl/Fast-Drone-250/devel/lib/map_generator/random_forest]
03-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JoannaJuanCV

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值