xcode 找不到“opencv2/opencv.hpp”文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13953570/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 04:40:35  来源:igfitidea点击:

'opencv2/opencv.hpp' file not found

xcodeopencv

提问by h4cky

I successfully installed OpenCV on Mac OS X 10.8.2.

我在 Mac OS X 10.8.2 上成功安装了 OpenCV。

After that I configured Xcode 4.5.2 by following this guideby SSteveeven that this guide was for Xcode 3.5.1 - everything was like it's suppose to be.

从那以后,我配置的Xcode 4.5.2本以下指南SSteve甚至认为这个指南为Xcode的3.5.1 -一切都像它的假设是。

My openCV dylib's are in: /usr/lib

我的 openCV dylib 位于:/usr/lib

  1. Always Search User Paths: YES
  2. Framework Search Path: /usr/lib** (** stands for recursive search)
  3. Header Search Path: /usr/lib** (** stands for recursive search)
  1. 始终搜索用户路径:是
  2. 框架搜索路径:/usr/lib**(**代表递归搜索)
  3. 头文件搜索路径:/usr/lib**(**代表递归搜索)

Full error message:

完整的错误信息:

Lexical or Preprocessor Issue
'opencv2/opencv.hpp' file not found

采纳答案by ArtemStorozhuk

Header Search Path: /usr/lib** (** stands for recursive search)

头文件搜索路径:/usr/lib**(**代表递归搜索)

It's definitely wrong. You should setup this path like:

肯定是错的。您应该像这样设置此路径:

/usr/local/include/opencv2**

or:

或者:

/usr/include/opencv2**

From your link:

从您的链接:

In the Search Paths section set Header Search Paths to /usr/local/include (/opt/local/include if you used MacPorts)

在 Search Paths 部分中,将 Header Search Paths 设置为 /usr/local/include(如果您使用 MacPorts,则为 /opt/local/include)

回答by iman kazemayni

In my case, I wrote:

就我而言,我写道:

/usr/local/include/opencv4

Header Search Path. I used opencv4, so I needed to add search_path a little bit deeper

标题搜索路径。我使用了 opencv4,所以我需要更深入地添加 search_path