Reputation: 2031
I'm trying to follow this tutorial: http://docs.opencv.org/doc/tutorials/ios/video_processing/video_processing.html
I have followed the steps but in the viewController.h file, it tells you to type "using namespace cv;" near the top of the file.
Xcode sees this as an error. And it won't let me build. How do I fix this?
Using XCode 4.6.3 and I can't tell what version of openCV I'm using but I just downloaded, so it's probably the latest. Also, I know that I've imported the opencv framework.
Here are the lines of code in viewController.h:
#import <UIKit/UIKit.h>
#import <opencv2/highgui/cap_ios.h>
using namespace cv;
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIButton *button;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
- (IBAction)actionStart:(id)sender;
@end
Upvotes: 3
Views: 857
Reputation: 2040
Try changing the extension of your ViewController from .m
to .mm
. That signals to the compiler that you would like to write that piece of code in Objective C++.
Edit: For additional information on how to write code effectively this way, check out this blog post.
Upvotes: 3