0

First at all, I have researched about this issued in a long times and I tried:

  • Rename .h -> .hpp
  • create prefix header

but still not working.

I use Swift for my project and I install OpenCV via CocoaPods:

pod 'OpenCV', '~> 3.3'

It works fine, but when I try to #import <opencv2/opencv.hpp> in header file it give me issues

core.hpp:49:4: Core.hpp header must be compiled as C++

YourEmoji-Prefix.pch

#ifndef YourEmoji_Prefix_pch
#define YourEmoji_Prefix_pch

#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#endif

#endif /* YourEmoji_Prefix_pch */

Wrapper.hpp

#pragma once


#ifdef __cplusplus
#include <opencv2/core/core.hpp>
#endif

Please give me any idea to fix this. Thank you so much.

Luan Tran
  • 1,142
  • 7
  • 15

1 Answers1

0

It's most likely that you put some C++ code or link opencv headers in header files. For more detail, see this answer.

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