OpenCV - 输入“IplImage”无法解决
我已经设置 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你确定你尝试过这些:
访问 http://opencv.willowgarage.com/wiki/EclipseOpenCVLinux
you sure u tried these:
Visit http://opencv.willowgarage.com/wiki/EclipseOpenCVLinux
我确实遇到了这个问题,并不是因为忘记编码或包含某些内容(代码在 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
incxoperations.hpp
even though the GUI finds it: when I Ctrl+click on it, it takes me tobits/atomicity.h
, which is properly included incxoperations.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.