热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Xcode8(斯威夫特):核心。hpp头必须被编译成c++。-Xcode8(Swift):core.hppheadermustbecompiledasC++

IamusingtheOpenCViOSFrameworkinaproject.Ifollowedthenecessarystepstoincludethefram

I am using the OpenCV iOS Framework in a project. I followed the necessary steps to include the framework into the project.

我正在一个项目中使用OpenCV iOS框架。我遵循了必要的步骤,将框架包含到项目中。

The Project is written using Swift 3.

项目是使用Swift 3编写的。

One of my classes that contains the core functionality of the App is written in Objective-C++. I included the header of the class in my Bridge-header file but when trying to run the project I get the following error:

我的一个类包含应用程序的核心功能,它是用objective - c++编写的。我将类的header包含在我的Bridge-header文件中,但是在尝试运行项目时,我得到以下错误:

error core.hpp header must be compiled as C++

错误的核心。hpp头必须被编译成c++。

After researching online and on SO, the most common solution presented was to create a Wrapper class that would be imported in the bridge header. However, after following this article I face the same problem.

在线研究之后,最常见的解决方案是创建一个包装类,该类将被导入到桥头中。然而,在阅读本文之后,我面临着同样的问题。

The Header file of my class looks like this:

我的类的头文件是这样的:

#if TARGET_OS_IPHONE
#import 
#define IMAGE_CLASS UIImage
#elif TARGET_OS_MAC
#import 
#define IMAGE_CLASS NSImage
#endif

#import 

#import 
#import 

#import 

typedef void (^DebugBlock)(cv::Mat current_image, std::string current_image_name);

@interface ImageScanner : NSObject

/**
 *  Singleton for access to the scanner.
 *
 *  @return Shared scanner.
 */
+ (instancetype)sharedScanner;

Does anyone have an idea what I might be missing?

有没有人知道我可能会错过什么?

Thank you in advance! G.

提前谢谢你!G。

1 个解决方案

#1


0  

had the same problem.. solved by importing any file that use openCV in the wrapperClass.mm file ...

有同样的问题。通过导入wrapperClass中使用openCV的任何文件来解决这个问题。mm文件…

SO Answer here

所以答案


推荐阅读
author-avatar
可怜小淖_135
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有