0

I have added opencv framework through cocoapods. I added required frameworks to Linked Frameworks and Libraries as well.

As, I am using Swift. So, I made a bridging header with "Wrapper" NSObject in Objective C. Problem is that when I try to import these in Wrapper.h, it gives me error

#import <opencv2/opencv.hpp>
#import <opencv2/imgcodecs/ios.h>

Error is:

Could not build module 'opencv2'

Where as if I import them in Wrapper.mm they work fine. Kindly tell me how to use them in header file. As I need to call a few variables from header file.

Ella
  • 105
  • 8

1 Answers1

1

When bridging header files to Swift, the files have to be pure Objective-C++. So you cannot include any opencv headers in Wrapper.h, they have to go in Wrapper.mm. For more detail how to write and use a wrapper, see my answer here.

Quang Hoang
  • 146,074
  • 10
  • 56
  • 74