Ask Your Question

Cannot compile FaceDetectVideo example code

asked 2012-12-04 15:21:56 -0500

harshi gravatar image

updated 2012-12-04 15:24:34 -0500

I am trying to compile the FaceDetectVideo sample code for iPhone made by Eduard and can be found on this online repository:

I have downloaded the opencv framework which is the folder called "opencv2.framework". I also downloaded the "shared" folder found on the above mentioned repository. All the files are there in the xcode project except for the haarcascade files.

The haarcascade files are not in the opencv framework for iOS so I tried adding them to the project from the regular opencv (for PC) library. This did not work however.

I keep getting the compile error:

"directory not found for option '-F/Users/../FaceDetectVideo/.../.../

Undefined symbols for architecture i386: "cv::CascadeClassifier::load(std::string const&)", referenced from: -[CvFaceDetector loadCascade:] in CvFaceDetector.o"

There are a bunch of other errors that follow this but I think they are caused by a single problem which I am unable to identify.

If anyone has been able to successfully run Eduard's code on their Mac could you please tell me what steps were involved?

Thanks a lot!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-12-05 06:46:37 -0500

yuval gravatar image

I didn't manage to grab the code from (can you tell me how?)

But you can use the next FaceDetectSimple project from the next gsoc2012 Git repository

edit flag offensive delete link more


I got the code by using terminal on the mac and typed in "svn" followed by the link and it automatically did the downloading for me...

harshi gravatar imageharshi ( 2012-12-05 09:18:32 -0500 )edit

the FaceDetectSimple project that you linked me to uses the older OpenCV framework. I want to use the FaceDetectVideo sample because it uses the newer framework

harshi gravatar imageharshi ( 2012-12-05 09:27:29 -0500 )edit

Ok, after downloading the code from the svn link you provided and using OpenCV 2.4.3 (download from this site - didn't used a compiled one) it seems that you should update the project settings.

  1. Go to build settings -> framework search path and remove unused frameworks paths (from your error you have the path for "Users/../FaceDetectVideo/.../.../" and i think you don't have this path on your system)
  2. You should change the target Compiler language, see here the John answer
  3. I needed to re-insert the XMLs for the ocv data, also i needed to change their path to be "relative for the SDK" in the file location settings)

The project runs with xCode4.5 and iPod5

yuval gravatar imageyuval ( 2012-12-05 16:21:30 -0500 )edit

okay I did as you instructed and also followed John's answer. It got rid of the 22 compile errors that I was getting. But now I get this new error:

Undefined symbols for architecture i386: "_objc_setProperty_nonatomic", referenced from: -[CvVideoCamera setCustomPreviewLawer:] in opencv2(cap_ios_video_camera.o).....and a bunch of other stuff.

I am running this on Xcode 4.4

harshi gravatar imageharshi ( 2012-12-05 18:31:15 -0500 )edit

I thought this error might have something to do with the iOS versions of the base sdk of the app and deployment target not matching, but I just checked and they both are set to iOS 5.1

I just came across this:

seems like it is an actual bug in the code and has to do with XCode 4.4.

I will try updating xcode and seeing how it goes.

Thank a lot for your help yuval :)

harshi gravatar imageharshi ( 2012-12-05 18:39:56 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2012-12-04 15:21:56 -0500

Seen: 910 times

Last updated: Dec 05 '12