Can't add cv.h to project

I am new to Xcode. And I need help to add lib to my project. I downloaded the opencv framework. I added it to my project. In main.h I have:

#include <stdio.h>  
#include <cv.h> 
#include <highgui.h>

#import <UIKit/UIKit.h>   
#import "AppDelegate.h"


int main(int argc, char *argv[])

{
    @autoreleasepool {

    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}

      

}

When I run my project, I got this error: cv.h not found, highgui.h not found. I check / usr / include through terminal and I saw that cv.h and highgui.h are in there. Tell me who should I do?

+3


source to share


4 answers


You have to update your build settings in xcode. the error message says that xcode doesn't know where to find these files. There are two settings that need to be updated in xcode build settings.

  • Library search paths

There are many settings in xcode. To reduce the number of fields you have to complete, use the search box in the upper right corner. If you type Library , you see the heading of the Search Path section , which has the Library Search Paths option . Update this field with the location of your library headers. The most common location is / usr / local / lib.



  • Title search contours

As with step 1, you can reduce the number of xcode options displayed using the search box. Find the Title and you will see a section labeled Search Paths with the Title Search Paths option . Update this field with the location of your library headers.

+1


source


try

#include <opencv/cv.h>

OR

#include <opencv2/opencv.hpp>

      



For more information on installing OpenCV - Click here

+7


source


try this:

#include <opencv/cv.h> 
#include <opencv/highgui.h>

      

if that still doesn't work you are trying to install opencv using MacPorts. You can find the module at this link: https://www.macports.org/ports.php?by=library&substr=opencv

+3


source


Make sure the set location for your OpenCV headers is in your user header search path in Xcode. You can set this either in the project settings or in the build settings for your purpose.

0


source







All Articles