Question

I'm using PCL 1.6, OpenCV 2.4.2 for my program (in Qt) and there is this flann (1.7.1) conflict I cannot resolve.

I have already read a lot about it on the internet, and tried most of the solutions (not using using namespace cv, update the latest version of OpenCV and put PCL includes before OpenCV inludes etc.), but still whenever I use PCL and OpenCV together, the flann-lib (which PCL uses) would cause problem and say e.g. for this line of code typedef flann::Index<Dist> FLANNIndex;

/usr/include/pcl-1.6/pcl/kdtree/kdtree_flann.h:74: error: 'flann' does not name a type

Is there any other workaround?

Was it helpful?

Solution 2

I seemed to have found a solution, but I'm not sure it's the best one.

  1. I added #include <flann/flann.h> to ../include/pcl-1.6/pcl/kdtree/kdtree_flann.h, afterwards the error mentioned above went away.

  2. But then OpenCV was having trouble to find its "flann/flann.h", so I changed the directory in ../include/opencv2/flann to flanncv and of course I had also to do this for every .h file which includes this directory, too.

It's not a very neat solution, but it is working for now.

OTHER TIPS

ran into the same problem.

there's one implementation of flann in opencv, and another(probably the same) in pcl.

originally, they live in separate NAMESPACES, but if you do like

using namespace cv;
using namespace pcl;

you get the conflict there.

so, skipping the using namespace cv; line, and instead using cv::anything in the code solved it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top