4

Many people provide the solution in Objective-c by renaming .m to .mm. But how to solve it in Swift?

berak
  • 39,159
  • 9
  • 91
  • 89
Martin Yang
  • 73
  • 1
  • 7

3 Answers3

2

I ran across this problem recently converting an Obj-C program to a hybrid one with Swift / Obj-C. I was fully aware of the 'm' / 'mm' issue so that wasn't my problem.

What caused this issue for me was that I had put an include file in the 'bridging' header that referred to OpenCV - both the the #include file and some definitions. Whoops.

Answer: Check to see if your bridging #include file somehow references opencv - remove.

Peter Gaston
  • 176
  • 13
  • I believe this is my issue too. If this is the case how do you pass an Object processed by OpenCV back to swift without causing this clash? – Cornell Skyers Dec 06 '16 at 18:23
0

In my case, the problem was the import line in prefix header file. After removing this import, my problem solvedenter image description here

Ozgur Sahin
  • 1,305
  • 16
  • 24
0

I ran into this problem while working with opencvframework. I fixed this issue by adding #import opencv2/opencv.hpp in objective c .h files. This might be help you!