How To Safely Use OpenCV 2.4.7 and OpenCV 3.0.0 In Same Project?
Language: C++
OS : Linux (Ubuntu)
Hi Everyone,
I'm developing a program where I need to use both OpenCV 2.4.7 and OpenCV 3.0.0 in the same project. I need OpenCV 2.4.7 due to legacy dependencies that a framework I'm using has, and I need OpenCV 3.0.0 for the HDR fusion library. There is no way that I can split the framework and the HDR fusion class/library apart into separate projects.
I've been having problems using both libraries together, as one would expect. At first, OpenCV 3.0.0's header files were actually pointing at OpenCV 2.4.7's header files. I fixed this by appending a "_" character on the OpenCV 3.0.0 folder, so now I can differentiate 2.4.7 from 3.0.0 by using #include <opencv2/...>
vs. #include <opencv2_/>
, respectively.
I have a new problem that I'm not sure how to solve. When I try to compile my code, I get errors about undeclared variables and such. I believe that there is a namespace conflict, and/or perhaps I've entered DLL hell.
/usr/local/include/opencv2_/imgproc.hpp:637: error: 'BORDER_REPLICATE' was not declared in this scope
/usr/local/include/opencv2_/imgproc.hpp:988: error: 'BORDER_DEFAULT' was not declared in this scope
/usr/local/include/opencv2_/imgproc.hpp:1049: error: 'BORDER_CONSTANT' was not declared in this scope
Note that I have successfully compiled and run a test project that only uses the HDR library in OpenCV 3.0.0, so I know that it works standalone.
Has anyone been able to successfully use different versions of OpenCV in the same project? If so I'd really appreciate hearing about it.