简体   繁体   English

OpenCv-iOS MapKit冲突

[英]OpenCv - iOS MapKit conflict

I am trying to use OpenCv 2.3.1 in my iOS project. 我试图在我的iOS项目中使用OpenCv 2.3.1。 But it is conflicting with the iOS MapKit. 但这与iOS MapKit冲突。 It's says: 说:

/iPhoneOS5.0.sdk/System/Library/Frameworks/MapKit.framework/Headers/MKGeometry.h:135: error: 'isinf' was not declared in this scope /iPhoneOS5.0.sdk/System/Library/Frameworks/MapKit.framework/Headers/MKGeometry.h:135:错误:在此范围内未声明“ isinf”

The function 'isinf' seems to be implemented in the MapKit as well as in the OpenCv library. 函数“ isinf”似乎已在MapKit和OpenCv库中实现。 If i delete all references to the MapKit, OpenCv is working in my iOS project. 如果我删除对MapKit的所有引用,则OpenCv正在我的iOS项目中工作。 But i need both? 但是我都需要吗? What can i do? 我能做什么?

For including OpenCv in my iOS project i followed this tutorial: http://aptogo.co.uk/2011/09/opencv-framework-for-ios/ 为了在我的iOS项目中包含OpenCv,我遵循了本教程: http ://aptogo.co.uk/2011/09/opencv-framework-for-ios/

This appears to be a known problem when using MapKit in an Objective-C++ project. 在Objective-C ++项目中使用MapKit时,这似乎是一个已知问题 Note that it is nothing to do with OpenCV. 请注意,这与OpenCV无关。

isinf is declared as a macro in math.h but in an Objective-C++ project, which #includes <cmath>, isinf is #undef'd and std::isinf is declared instead as a wrapper. math.h isinf声明为宏,但在一个Objective-C ++项目(其中包括isinf >)中,将isinf为#undef'd,而将std::isinf声明为包装器。

A workaround is to add this line before you #import MKGeometry.h or any of the other MapKit headers: 一种解决方法是在#import MKGeometry.h或任何其他MapKit标头之前添加此行:

using namespace std;

Your issue is not between these libraries, because isinf is declared in the math library (compilation using -lm). 您的问题不在这些库之间,因为isinf是在数学库中声明的(使用-lm进行编译)。

The manpage of isinf tells to include math.h : isinf的联机帮助页告诉您包括math.h:

#include <math.h>

What are your system include paths ? 您的系统包含什么路径?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM