iOS - 核心hpp头必须用c ++编译

问题描述 投票:0回答:1

首先,我已经研究了很长一段时间发布的这个,我尝试过:

  • 重命名.h - > .hpp
  • 创建前缀头

但仍然没有工作。

我使用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++ ios opencv
1个回答
0
投票

您最有可能在头文件中放入一些C ++代码或链接opencv标头。有关更多详细信息,请参阅this answer

© www.soinside.com 2019 - 2024. All rights reserved.