OpenCV 使用 Eclipse 和 CDT
我一直使用 QtCreator for OpenCV,但是与朋友开始的一个新项目需要使用 eclipse 来完成。
我做了我通常用 QtCreator 做的所有事情,但我遇到了一个奇怪的问题。尽管我在尝试编译时确实设置了包含路径(/home/opencv/include),但我收到了缺少标头的错误(即 opencv2/core/core.hpp)。在包含标签下的项目资源管理器中,唯一出现的标题是包含目录第一级中的标题。这意味着 cdt 不会递归地包含标头。
这是一个错误还是我必须包含每个目录?
I was always using QtCreator for OpenCV but a new project started with a friend needs to be done with eclipse.
I did all things I usually do with QtCreator but I am facing a strange problem. Although I did set the include path (/home/opencv/include) when I try to compile I get errors for missing headers (i.e opencv2/core/core.hpp). In the project explorer under include tag the only headers appear are the ones in the first level of the included directory. This means that cdt does not include headers recursively.
Is this a bug or I have to include every single directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我昨天也遇到了同样的问题。它搜索了整个论坛,但没有人能回答我。最后我意识到我正在对整个项目进行包含,并且项目的包含文件与源文件“source.txt”的包含文件不同。 cpp”(对于 eclipse,因为对于 VisualStudio 来说是相同的)。
因此,尝试右键单击 .cpp 文件并包含其目录。不管怎样,如果你告诉我你正在使用哪个版本的 OpenCV,我可以告诉你如何包含文件的更多方面,以防你继续遇到麻烦。
我希望它有帮助。当您收到有关缺少标头的错误时,始终与包含相关。至少我的情况是这样的。
I had the same problem yesterday. It searched all around forums but nobody could answer me. Finally I realized that I was doing the include for the whole project and including files for the project is not the same as including files for the source file "source.cpp" (for eclipse, because for VisualStudio it is the same).
So try to rightclick on the .cpp file and include the directories for it. Anyway, if you tell me which version of OpenCV you're using I can tell you more aspects of how to include files in case you keep having troubles.
I hope it helps. When you get errors about missing headers is always related to include. At least it happened to be like this in my case.
如果 Eclipse 中的包含路径是
/home/opencv/include
,我们假设该目录中有 2 个文件夹:opencv 和 opencv2。在源代码中,您必须将标头引用为:
这对您有意义吗?
不过,有一些教程可以帮助您配置 Eclipse。
If the include path in Eclipse is
/home/opencv/include
, we assume that inside this directory you have 2 folders: opencv and opencv2.On your source code you must reference the headers as:
Does that makes sense to you?
Nevertheless, there are several tutorials that can help you configure Eclipse.
我也有这个问题。我认为你需要做的是包含路径 opencv/build/include,而不是 opencv/include。这是所有头文件所在的位置。
I had this problem, too. I think what you need to do is to include the path opencv/build/include, not opencv/include. That's where all the header files are.