问题描述
我正在使用OpenCV 2.4.2和Point Cloud Library 1.6.0.
I'm using OpenCV 2.4.2 and Point Cloud Library 1.6.0.
在添加行之前,我的程序运行良好...
My program is working fine until I add the line...
#include <pcl/segmentation/segment_differences.h>
当我尝试编译时,这会导致错误.我得到...
Error 93 error C2872: 'flann' : ambiguous symbol C:\Program Files (x86)\PCL 1.6.0\include\pcl-1.6\pcl\kdtree\kdtree_flann.h 424
Error 94 error C2872: 'flann' : ambiguous symbol C:\Program Files (x86)\PCL 1.6.0\include\pcl-1.6\pcl\kdtree\kdtree_flann.h 425
Error 95 error C2872: 'flann' : ambiguous symbol C:\Program Files (x86)\PCL 1.6.0\include\pcl-1.6\pcl\kdtree\kdtree_flann.h 427
Error 96 error C2872: 'flann' : ambiguous symbol C:\Program Files (x86)\PCL 1.6.0\include\pcl-1.6\pcl\kdtree\kdtree_flann.h 514
Error 97 error C2872: 'flann' : ambiguous symbol C:\Program Files (x86)\PCL 1.6.0\include\pcl-1.6\pcl\kdtree\kdtree_flann.h 520
C:\Program Files (x86)\PCL 1.6.0\include\pcl-1.6\pcl/kdtree/kdtree_flann.h(520): error C2872: 'flann' : ambiguous symbol
could be 'flann'
or 'cv::flann'
因此,看来OpenCV随附的Flann文件与PCL中的Flann文件发生冲突.
So it looks like the Flann files that come with OpenCV are getting a conflict with the Flann files in PCL.
有什么建议吗?
这里有一个类似的问题 PCL,OpenCV和flann冲突但这是一个略有不同的错误...
There is a similar question herePCL, OpenCV and flann conflictbut it's a slightly different error...
因此我以前在main.cpp文件中拥有
so in my main.cpp file I previously had
使用命名空间pcl;使用命名空间cv;
using namespace pcl;using namespace cv;
我注释掉了这两个,并更新了程序以使用cv :: Mat等.
I commented these two out and updated the program to use cv::Mat etc.
但是当我添加...时,在编译过程中仍然出现错误.
but I still get errors during compile when I add...
#include <pcl/segmentation/segment_differences.h>
C:\Program Files (x86)\PCL 1.6.0\include\pcl-1.6\pcl/kdtree/kdtree_flann.h(520): error C2872: 'flann' : ambiguous symbol
could be 'flann'
or 'cv::flann'
我刚刚尝试将include \ opencv2 \ flann \重命名为include \ opencv2 \ flanncv \,并将一堆opencv标头中的include更新到这个新的flanncv目录.我仍然遇到上述错误...
I've just tried renaming include\opencv2\flann\ to include\opencv2\flanncv\ and updating the includes in a bunch of opencv headers to this new flanncv directory. I'm still getting the above error...
推荐答案
因此无需重建内容即可解决此问题的方法是在其中添加一个空名称空间
So a fix for this without having to rebuild things is to add a null namespace to it
更改的实例flann ::某物到:: flann :: something
change instances offlann::somethingto::flann::something
我认为这实际上是在告诉它使用全局名称空间而不是cv名称空间.
I think it's effectivly telling it to use the global namespace and not the cv namespace.
这篇关于OpenCV和PCL有冲突吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!