简体   繁体   English

ios opencv2.framework很奇怪

[英]ios opencv2.framework is quite strange

I am new to Xcode for ios. 我是Xcode for ios的新手。 I encountered a very strange issue. 我遇到了一个非常奇怪的问题。

My Xcode is 7 under MacOS EI. 我的Xcode在MacOS EI下是7。 and I download the opencv samples for ios https://github.com/Itseez/opencv_for_ios_book_samples 我下载了ios的opencv示例https://github.com/Itseez/opencv_for_ios_book_samples

And after that I download the opencv2.framework for ios not Mac (they are different) 然后我下载了ios而不是Mac的opencv2.framework(它们是不同的)

but, after I unzipped the opencv2.framework, the folders' names are very strange. 但是,在我解压缩opencv2.framework后,文件夹的名称非常奇怪。 There is no folder named "opencv2" but "Headers". 没有名为“opencv2”但名为“Headers”的文件夹。 If so, how could you find the correct path???? 如果是这样,你怎么能找到正确的路径????

In addition, where is the shared library? 另外,共享库在哪里? the next folder is named "opencv2" without any suffix. 下一个文件夹名为“opencv2”,没有任何后缀。

In order to make the paths correct, I changed the "h" files folder name to be "opencv2", so the project can find the header files. 为了使路径正确,我将“h”文件夹名称更改为“opencv2”,因此项目可以找到头文件。 But still can not link to the library. 但仍然无法链接到图书馆。 The error is as follows. 错误如下。

ld: framework not found opencv2 clang: error: linker command failed with exit code 1 (use -v to see invocation) ld:找不到框架opencv2 clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)

Although I have set the search path for headers and library. 虽然我已经设置了标题和库的搜索路径。

I have searched a lot but no answers, Could you please give some ideas?? 我已经搜索了很多但没有答案,你能不能给出一些想法?

Thank you in advance! 先感谢您!

I have resolved it!! 我已经解决了!!

  1. first in the "Headers" folder, create a folder named "opencv2" and then cut all the other files into it. 首先在“Headers”文件夹中,创建一个名为“opencv2”的文件夹,然后将所有其他文件剪切到其中。 This solves that "cannot find the include file". 这解决了“找不到包含文件”的问题。

  2. just drop this modified opencv2.framework into the Xcode project's frameworks. 把这个修改过的opencv2.framework放到Xcode项目的框架中。 Then appears a window. 然后出现一个窗口。 Remember to choose "copy file if needed". 请记住选择“如果需要,复制文件”。

  3. change to the TARGET build Settings, just add the search headers path. 更改为TARGET构建设置,只需添加搜索标题路径即可。

Done! 完成!

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

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