Xcode 7 and openCV (no Swift): Core.hpp header must be compiled as C++

后端 未结 4 1747
Happy的楠姐
Happy的楠姐 2021-02-07 09:42

I have followed the instructions on how to install OpenCV on an iOS project. However when using Xcode 7 I had to add manually a prefix header. Doing this unfortunately did not h

4条回答
  •  耶瑟儿~
    2021-02-07 10:12

    The solution is almost the same as we do bridging ObjectiveC and swift but we do it between Objective C and C++ so we put the C++ codes in a separate file with (.mm) extension and then import it to your Objective C File (.m)

    For example if you have ViewController.h and ViewController.m you add two more files which include your C++ codes lets name it OpenCV.mm and OpenCV.h then import the OpenCV.h inside ViewController.m even before you import anything else. May be this image will help understand it:

    Tested on Xcode 11.6 OpenCV Ver 3.4.3

提交回复
热议问题