简体   繁体   中英

OpenCv - iOS MapKit conflict

I am trying to use OpenCv 2.3.1 in my iOS project. But it is conflicting with the 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

The function 'isinf' seems to be implemented in the MapKit as well as in the OpenCv library. If i delete all references to the MapKit, OpenCv is working in my iOS project. 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/

This appears to be a known problem when using MapKit in an Objective-C++ project. Note that it is nothing to do with 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.

A workaround is to add this line before you #import MKGeometry.h or any of the other MapKit headers:

using namespace std;

Your issue is not between these libraries, because isinf is declared in the math library (compilation using -lm).

The manpage of isinf tells to include math.h :

#include <math.h>

What are your system include paths ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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