Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Errors when trying to import the OpenCV framework into an iOS project

I downloaded the official version of iOS framework from opencv.org and then created a simple view-based Xcode project and added the opencv2.framework in the build phases menu.

After that I imported the opencv2.framework as:

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

into the *.pch file.


I have this function:

static void testOpenCV
{
    cv::Mat m, gray;
}


When I ran the build - it showed me this error:

~/projects/xcode/openCV_ex/openCV_ex/ViewController.m:45:8: Expected expression


When I try to include the OpenCV framework before any definitions in my .pch file like this:

#import <opencv2/opencv.hpp>
#import <Availability.h>
….


I get this error:

~/Downloads/opencv2.framework/Versions/A/Headers/video/background_segm.hpp:48:1: Unknown type name 'namespace'



Can you please help me to find a solution to this problem?