Reputation: 781
I have function in .mm file.
I want to call that function from my Viewcontroller file .m. But it always gives me compiler error when i am try to import .h file of c function.
I have class file like.
OpenCV.h
OpenCV.mm
ViewController Class
ViewController.h
ViewController.m
Now when i am import OpenCV.h
it gives me error. not able to compile
#import "OpenCV.h" //Error Line
@implementation ViewController
@end
So how can i use .mm method in .m class
Error comes in OpenCV.h
file
Upvotes: 2
Views: 1713
Reputation: 224864
You can't do that - you're trying to compile an Objective-C++ header in an Objective-C context. You should just be able to change the name of ViewController.m
to ViewController.mm
to compiler it as Objective-C++ instead.
Upvotes: 2