Eclipse compiles successfully but still gives semantic errors(Eclipse 编译成功但仍然给出语义错误)
问题描述
注意:这显然是 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 包含在开头和结尾. 
- Clean up the project
 - Rebuild, refresh, and all the other options in the "Index" submenu (when "right-clicking" on the project)
 - Disable / enable the indexer in the preferences
 - Verify that symbols such as 
trainIdxonly appear in my OpenCV4Android include in thePaths and Symbolssection. - Change the order of my includes in the 
Paths and Symbolssection. 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构建我的项目. - 当我启动 Eclipse 时,在我打开一个 C++ 文件(来自 
jni文件夹)之前,我没有任何错误. - 我总是可以构建项目,但只要我打开了一个 C++ 文件,我就无法再运行应用程序了,因为很多 
Field '<name>'无法解决. - 如果我不打开 C++ 文件,Eclipse 不会报告任何错误,并且可以成功构建和部署 Android 应用程序.
 
- In command line, I can build my project using 
ndk-build cleanandndk-build. - When I start Eclipse, I have no error until I open a C++ file (from the 
jnifolder). - I can always build the project, but as long as I have opened a C++ file, I can't run the application anymore because of a lot of 
Field '<name>' could not be resolved. - If I don't open the C++ files, Eclipse doesn't report any error and can build and deploy the Android application successfully.
 
以下代码在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 编译成功但仍然给出语义错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Eclipse 编译成功但仍然给出语义错误
				
        
 
            
        - java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
 - 转换 ldap 日期 2022-01-01
 - 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
 - Eclipse 的最佳 XML 编辑器 2022-01-01
 - 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
 - 如何指定 CORS 的响应标头? 2022-01-01
 - 获取数字的最后一位 2022-01-01
 - 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
 - 未找到/usr/local/lib 中的库 2022-01-01
 - GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
 
						
						
						
						
						
				
				
				
				