Link Error about OpenCV in Xcode

蹲街弑〆低调 提交于 2019-12-06 13:06:51

You can setup link with c++ standard library via "Build Phases -> Link Binary With Libraries"

I get the answer.

The MIN macro in OpenCV is conflict with MIN predefined in Xcode.

Rename .m files to .mm, and change all MIN function to a new name such as CV_MIN in OpenCV's header files.

Check.

Bing, you are correct about the OpenCV's MIN (and MAX) macros. I have to rename them probably since v 2.0 :)

However, it's not necessary to rename all .m files to .mm files since Xcode treats them differently by default - being Objective-C++ files - which is not always what you want.

It's better to link std c++ library, as David pointed out above.

Another thing worth mentioning, at least in xcode 4.5, is that you have to change your C++ standard library to 'libstdc++' in your target settings to get openCV to compile.

Dropping the iOS 4.3 support and using the "libc++' might also help.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!