Environment:MacOS 10.12, CMake 3.9.0, python 2.7
I try to compile Opencv on mac using this tutorial,and after I followed Step 8, I got the error as follows:
/Users/niceycb/opencv/modules/videoio/src/cap_qtkit.mm:46:9: fatal error:
'QTKit/QTKit.h' file not found
#import <QTKit/QTKit.h>
^
1 error generated.
make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_qtkit.mm.o] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 35%] Linking CXX static library ../../lib/libopencv_shape.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../lib/libopencv_shape.a(precomp.cpp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../lib/libopencv_shape.a(precomp.cpp.o) has no symbols
[ 35%] Built target opencv_shape
make: *** [all] Error 2
And I tried to solve ''QTKit/QTKit.h' file not found', I followed this.
One solution is:
brew reinstall opencv3 --HEAD --with-python2 --with-ffmpeg --with-tbb --with-contrib
The error is
Error: opencv3: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-science/opencv3.rb:1: syntax error, unexpected '!', expecting end-of-input
?SDγ?qm?????5??...)?
^
Another solution is that using $brew edit opencv3 and commenting the following 4 lines:
if build.with?("python3") && build.with?("python")
# Opencv3 Does not support building both Python 2 and 3 versions
odie "opencv3: Does not support building both Python 2 and 3 wrappers"
end
Then I use $ brew install opencv3 --with-contrib. But the same error occurred.
Error: opencv3: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-science/opencv3.rb:1: syntax error, unexpected '!', expecting end-of-input
?SDγ?qm?????5??...)?
^