前言
为了测试自编译的opencv库是否能在苹果MacOS系统下使用,需要写一个简单的测试程序。这个测试程序写起来不难,麻烦的是一些配置。网上的办法很多,里面因为版本的问题有一些坑。特此写了一个建立步骤,供大家参考。
1、新建一个Console工程
首先用XCode新建一个Console工程。


这个team不要指定,涉及到TeamID,数字签名啥的,也比较麻烦,影响后续的编译和链接。

2、将调用opencv的代码写入
苹果MacOS 调用自编译opencv的Dylib显示一个图片程序的步骤

3、三处路径设置

4、Dylib库的加载
这一步相当的关键:




然后,选中所有的lib

如下图,这样就选进来了:

5、编译运行成功
如下图:
