OpenCV iOS - 预期标识符(宏)

3

从"opencv2.framework"中获取错误信息。

刚创建的一个包含“opencv2.framework”的新项目无法运行。

我的步骤:

  1. 下载最新的“opencv2.framework”
  2. 添加所需框架
  3. 声明.pch文件内容
  4. 将.m文件更改为.mm

我漏掉了什么吗?

enter image description here

#ifndef PrefixHeader_pch
#define PrefixHeader_pch

#import <Availability.h>

#ifndef __IPHONE_4_0
#warning "This project uses features only available in iOS SDK 4.0 and later."
#endif

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

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

#endif /* PrefixHeader_pch */

enter image description here

1个回答

10
第46行就是要点所在:您必须在任何Apple的头文件之前放置opencv.hpp。在PrefixHeader.pch中移动即可。
#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#endif

预备上场

#import <Availability.h>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接