OpenCV - 输入“IplImage”无法解决

发布于 2024-11-17 09:14:01 字数 221 浏览 3 评论 0原文

我已经设置 Eclipse 来使用 OpenCV 2.1。

当我尝试一个简单的程序时,出现以下错误:

Type 'IplImage' could not be resolved

对于以下行:

  IplImage* img = 0; 

如何解决此问题?

谢谢。

I have set up Eclipse to work with OpenCV 2.1.

When I try a simple program, I get the following error:

Type 'IplImage' could not be resolved

For the following line:

  IplImage* img = 0; 

How can I solve this issue?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

云胡 2024-11-24 09:14:01

你确定你尝试过这些:

  1. 添加了 OpenCV 核心头
  2. 包含了库?

访问 http://opencv.willowgarage.com/wiki/EclipseOpenCVLinux

you sure u tried these:

  1. Added the OpenCV core header
  2. Included the library?

Visit http://opencv.willowgarage.com/wiki/EclipseOpenCVLinux

香草可樂 2024-11-24 09:14:01

我确实遇到了这个问题,并不是因为忘记编码或包含某些内容(代码在 MSVC 中工作正常),

我比较了 Hello World 项目和我自己的项目中的 .cproject 文件,并且(除了很多标识符号不同)还有很多额外的行。我关闭了该项目,在编辑器中删除了这些附加行,重新打开了该项目,再次按照载波频率的步骤进行操作,结果成功了。

至少我是这么认为的。所有编译器错误都消失了,但现在我收到很多链接器错误,所有错误都与 OpenCV 本身内部发现的符号有关。看来链接器无法在 cxoperations.hpp 中找到 __exchange_and_add,即使 GUI 找到了它:当我按住 Ctrl 键并单击它时,它会将我带到 bits/atomicity .h,它正确包含在cxoperations.hpp中(但使用了未使用的命名空间)。

我通过将符号 __GNUC__ 从 3 更改为 4,并将 __GNUC_MINOR__ 从 4 更改为 0 来解决这个问题。
看来Gnu C++ 3.4不使用命名空间,而4.2及更高版本使用另一个我没有的include(ext/atomicity.h),所以我随意选择了4.0。

项目属性-> C/C++ 通用 ->符号

使用ADD更改两个符号,即使它们已经存在。对它们使用“编辑”只会在我的 Eclispe 版本中删除它们。

I had this issue for real, and not by forgetting to code or include something (code worked fine in MSVC)

I compared the .cproject files from the Hello World project and my own project, and (apart from lots of identifier numbers being different) there were a lot of additional lines. I closed the project, removed those additional lines in an editor, reopened the project, followed carrierfrequency's steps again, and it worked.

At least so I thought. All compiler errors are gone, but now I'm getting lots of linker errors, all about symbols found inside OpenCV itself. It seems the linker cannot find __exchange_and_add in cxoperations.hpp even though the GUI finds it: when I Ctrl+click on it, it takes me to bits/atomicity.h, which is properly included in cxoperations.hpp (but uses a namespace, which isn't used).

I solved this by changing the symbols __GNUC__ from 3 to 4 and __GNUC_MINOR__ from 4 to 0.
It seems Gnu C++ 3.4 doesn't use a namespace, and 4.2 and up use another include (ext/atomicity.h) which I don't have, so I arbitrarily chose 4.0.

Project Properties -> C/C++ General -> Symbols

Use ADD to change the two symbols, even though they already exist. Using Edit on them just removes them in my version of Eclispe.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文