2016-11-21 35 views
0

我有问题,以便在Xcode中安装OpenCV用C++开发。 我试图按照这种tutorial上的Xcode安装OpenCV的C++

但是,我有一个问题,当我在终端做make命令,我有这样那样的错误:

fatal error:
'QTKit/QTKit.h' file not found
#import
1 error generated.
make[2]: ***
[modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_qtkit.mm.o] Error 1

你有什么解决办法吗?

+0

做你检查你的pathes?也许它来自那里? – retinotop

回答

2

试图通过自制安装OpenCV的。为此,请打开终端并运行以下命令。

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 
brew install homebrew/science/opencv3 

最后一个命令将在/usr/local/Cellar/opencv3/3.1.0.3/安装OpenCV3和所有的依赖

然后你可以和.h/.HPP文件链接名为.dylib到XCode项目并使用OpenCV。

如果您有任何问题,我很高兴回答。

[编辑]: 如果你使用的MacOS 10.12或更高版本,安装OpenCV用下面的命令。

brew install opencv3 --with-ffmpeg --with-tbb --with-contrib 
brew reinstall opencv3 --HEAD --with-python3 --with-ffmpeg --with-tbb --with-contrib 
+0

谢谢你的回答。我想你的命令,但我仍然具有相同的误差:生成 #进口 ^ 1错误。 – andresouris

+0

@andresouris,你使用哪个版本的macOS? – Murad

+0

我使用的版本10.12.1在MacOS塞拉利昂 – andresouris