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>
This causes errors when I try to compile. I get…
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'
So it looks like the Flann files that come with OpenCV are getting a conflict with the Flann files in PCL.
Any suggestions?
Edit
There is a similar question here
PCL, OpenCV and flann conflict
but it’s a slightly different error…
Edit 2
so in my main.cpp file I previously had
using namespace pcl;
using namespace cv;
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'
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
change instances of
flann::something
to
::flann::something
I think it’s effectivly telling it to use the global namespace and not the cv namespace.