0

I was following another thread, as per answer: https://stackoverflow.com/a/30909377/6293090

The STL header can't be found by compiler when they are imported or included from objective C files The line:

\#include <opencv2/opencv.hpp>

or:

\#import <opencv2/opencv.hpp>

In my opencv.m wrapper compiler can't find headers included by opencv.hpp or , ('list' file not found), However, If I add C++ file to the project and use the same #include line in it, it compiles fine. I haven't found separate header search path for objective C in the project's build setting.

What am I missing? Thanks.

Community
  • 1
  • 1
Marek
  • 41
  • 1
  • 2

1 Answers1

1

You need to create an Objective-C++ file, one with .mm extension instead of .m, and then you can mix Objective-C and C++ code in that implementation file as well as include C++ headers into it.

Create an Objective-C (.m) file in Xcode and rename it to have the .mm extension, and you're all set!

Here is another related question that might be helpful: Video processing with OpenCV in IOS Swift project.

Community
  • 1
  • 1
Anatoli P
  • 4,791
  • 1
  • 18
  • 22