Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal error: 'QTKit/QTKit.h' file not found when I build OpenCV on mac

I have followed this http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/ to install OpenCV on my mac. When I do this step : $ make -j4 a problem happened:

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: ***
[all] Error 2
like image 605
潘思源 Avatar asked Sep 20 '16 09:09

潘思源


2 Answers

Try building it like this instead:

cmake -DWITH_QUICKTIME=OFF -DWITH_GSTREAMER=OFF -DWITH_FFMPEG=OFF -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_BUILD_TYPE=Release .. ; make -j4
like image 86
Ohad Kravchick Avatar answered Sep 22 '22 08:09

Ohad Kravchick


Here is a workaround solution to fix the issue:

  1. Download MACOSX SDK here.
  2. extract head files from MacOSX10.11.sdk/MacOSX10.11.sdk/System/Library/Frameworks/QTKit.framework/Headers/
  3. Create a folder under opencv source file folder: opencv-3.2.0/modules/highgui/src/QTKit, and copy all header files into the folder.
  4. Follow the regular opencv build steps. When you run make -j8, you don't need set "-DWITH_QUICKTIME=OFF -DWITH_GSTREAMER=OFF -DWITH_FFMPEG=OFF"

This works for opencv2.x and 3.x

like image 21
feiyun Avatar answered Sep 22 '22 08:09

feiyun