注意:这显然是 StackOverflow 上经常出现的问题,但是 - 就我所见 - 人们永远找不到方法,或者他们的解决方案对我不起作用
我正在使用 Eclipse Juno ADT.在我尝试更新 NDK 之前,一切正常.我用新版本(即 ndk-r8e
)替换了我的 ndk
文件夹(即 ndk-r8d
),并且在我的 Paths and Symbols
配置,我将包含从 g++ 4.6 更改为 4.7.
I am using Eclipse Juno ADT. Everything was working fine until I tried to update the NDK. I replaced my ndk
folder (that was the ndk-r8d
) by the new version (i.e. ndk-r8e
) and, in my Paths and Symbols
configuration, I changed the includes to go from g++ 4.6 to 4.7.
它似乎破坏了我的索引:我可以编译我的代码,但是 Eclipse 给出了语义错误,就像 [1] 和 [2].错误主要来自OpenCV4Android使用的符号,如distance
,pt
、queryIdx
和 trainIdx
.
It seemed to break my index: I could compile my code, but Eclipse was giving semantic errors, exactly like in [1] and [2]. The errors mainly come from symbol used by OpenCV4Android, such as distance
, pt
, queryIdx
and trainIdx
.
当我尝试备份到旧配置时,索引仍然损坏!我找不到改变这种情况的方法.
When I tried to backup to my old configuration, the index was still broken! I cannot find a way to change this.
trainIdx
等符号仅出现在我的 OpenCV4Android 的 Paths and Symbols
部分中.Paths and Symbols
部分更改我包含的顺序.我基本上尝试将 OpenCV 包含在开头和结尾.trainIdx
only appear in my OpenCV4Android include in the Paths and Symbols
section.Paths and Symbols
section. I basically tried to put the OpenCV include in the beginning and in the end.我认为它是 CDT 索引,原因如下:
I assume that it is the CDT index because of the following:
ndk-build clean
和 ndk-build
构建我的项目.jni
文件夹)之前,我没有任何错误.Field '<name>'无法解决.
ndk-build clean
and ndk-build
.jni
folder).Field '<name>' could not be resolved.
以下代码在line
、queryIdx
、pt
报错:
cv::line(mRgb, keypointsA[matches[i].queryIdx].pt, keypointsB[matches[i].trainIdx].pt, cv::Scalar(255, 0, 0, 255), 1, 8, 0);
如果我这样写,它可以工作:
If I write it as follows, it works:
cv::DMatch tmpMatch = matches[i];
cv::KeyPoint queryKp = keypointsA[tmpMatch.queryIdx];
cv::KeyPoint trainKp = keypointsB[tmpMatch.trainIdx];
cv::line(mRgb, queryKp.pt, trainKp.pt, cv::Scalar(255, 0, 0, 255), 1, 8, 0);
并不是所有的 OpenCV 函数都未解析:只有 pt
、queryIdx
和 trainIdx
是.
It is not that all of the OpenCV functions are unresolved: only pt
, queryIdx
and trainIdx
are.
任何评论将不胜感激.
在 Eclipse 环境中选择的项目首选项中,转到 C/C++ 常规 -> 代码分析 -> 启动.确保两个复选框都未选中.关闭并重新打开项目或重新启动 eclipse 并重建项目.
In your selected project preferences within the Eclipse environment, go to C/C++ General -> Code Analysis -> Launching. Make sure that both check boxes are unchecked. Close and reopen the project or restart eclipse and rebuild the project.
这篇关于Eclipse 编译成功但仍然给出语义错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!