I am trying to set up OpenCV
to work with QT
on OSX 10.7.5/MacbookPro 2.5 Ghz Intel Core 2 Duo. I\'ve seen a few related question here (How to link
I just stumbled over the same problem. Here is how I solved it:
As sansuiso already suggested, the problem appears to be the C++-STD-lib you are trying to link against. You are probably trying to link libc++ (LLVM ...) but instead libstdc++ (GNU C++ ...) should be used.
Using the Qt Creator you can add the following to your .pro-file:
mac: CONFIG += MAC_CONFIG
MAC_CONFIG {
QMAKE_CXXFLAGS = -std=c++11 -stdlib=libstdc++ -mmacosx-version-min=10.7
QMAKE_LFLAGS = -std=c++11 -stdlib=libstdc++ -mmacosx-version-min=10.7
}
This answer could also be interesting for your problem: https://stackoverflow.com/a/12852913/1141118
Hope this helps!
You are facing 2 potential issues here:
/usr/local
. You can avoid this by different approaches: using a static opencv lib, using install_tool
to change the path to the library coded in the output binary, or by using the preferences of QtCreator to set the DYLD_LIBRARY_PATH
variable to something like /usr/local/lib
when it runs your program.Just a naive mistake
The proper declaration is:
LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_imgproc \
-lopencv_features2d\
-lopencv_highgui