I'm not able to build a project in Xcode 5.0.2 using (the latest) openCV iOS framework release. I've been trying to use the pre-built framework downloaded from the openCV sourceforge page. I followed the steps on the openCV tutorial to add the framework to Xcode, and I also tried adding the libc++.dylib and/or the libstdc++.dylib binaries to the project as well.
The error I get is a preprocessing /lexical error that says it cannot find the file
<opencv2/opencv.hpp>
but in the Xcode file navigator I can indeed see it. If I don't #include the opencv.hpp file I get about 30 linker errors when I try to build the project. Any ideas about how to get this to work? I've seen some other posts here, and I've tried to build the framework from source myself, but nothing has seemed to exactly match my problem.
UPDATE: Also to be more clear - I'm using Xcode 5.0.2, target build is iOS 7.0 for standard architectures (armv7 and armv7s).
C++ compiler is Apple LLVM 5.0, C++ language dialect setting is "compiler default" and C++ compiler setting is "libc++ (LLVM C++ standard library with C++11 support)"
Using the pre-build iOS framework available on opencv.org is easy:
add the opencv2.framework to your project

in your project's prefix header file (.pch) add
#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#endif
which will import OpenCV's header in all C++ source file
What I'm guessing is that you're trying to use OpenCV in .m files, which by default are Objective-C (not C++) files. Since the OpenCV framework for iOS is written in C++ you can use it only in C++ source files.
The easiest way to add an Objectice-C++ file to Xcode is to set the extension of the source files to .mm.
Alternatively (and just for the records) you can change the File type to Objective-C++ Source in the "File inspector"

or add the -x objective-c++compiler flag in the target's build phase.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With