首先,我已经研究了很长一段时间发布的这个,我尝试过:
但仍然没有工作。
我使用Swift作为我的项目,我通过CocoaPods安装OpenCV:
pod 'OpenCV', '~> 3.3'
它工作正常,但当我尝试在头文件中的#import <opencv2/opencv.hpp>
它给我的问题
core.hpp:49:4:Core.hpp头必须编译为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
请给我任何想法来解决这个问题。非常感谢。
您最有可能在头文件中放入一些C ++代码或链接opencv
标头。有关更多详细信息,请参阅this answer。