Anirudh GP Anirudh GP - 3 months ago 56
iOS Question

opencv2/opencv.hpp file not found in Xcode

I have built openCV to get opencv2.framework. I added this to my xcode iOS project by going to "build phases->Link Binary With Libraries", then tried to include "opencv2/opencv.hpp" in my project.
I get the error "opencv2/opencv.hpp" not found. But the file exists in the framework. I have tried to find a solution online but nothing has worked for me.

The file I'm trying to include it in is a .mm file. I have made "compile sources as" objective-c++. Any help would be great.


Took me 4 hours to figure this out. This is how I got this to work : Along with the opencv framework add the following frameworks in the build phases:

Accelerate, AssetsLibrary, AVFoundation , CoreGraphics , CoreImage , CoreMedia , CoreVideo , QuartzCore , UIKit , Foundation.

Then, in the .pch file add these lines before UIKit and Foundation imports :

#ifdef __cplusplus
#import <opencv2/opencv.hpp>