Eclipse编译成功但仍然会产生语义错误 [英] Eclipse compiles successfully but still gives semantic errors

查看:381
本文介绍了Eclipse编译成功但仍然会产生语义错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意:这显然是StackOverflow的一个常见问题,但是 - 对于我所看到的 - 人们永远都不会找到一种方式,或者他们的解决方案对我来说不起作用。



问题:



我正在使用Eclipse Juno ADT。一切都正常,直到我尝试更新NDK。我通过新版本替换了我的 ndk 文件夹(即 ndk-r8d )(即 ndk-r8e ),在我的路径和符号配置中,我将包含从g ++ 4.6更改为4.7。



似乎打破了我的索引:我可以编译我的代码,但是Eclipse发出语义错误,就像在[ 1 ]和[错误主要来自OpenCV4Android使用的符号,例如距离 pt queryIdx trainIdx



当我尝试备份到我的旧配置时,索引仍然损坏!我没有办法改变这个。






我尝试过的




  • 清理项目

  • 在索引子菜单中重建,刷新和所有其他选项(当右键单击时)项目)

  • 在首选项中禁用/启用索引器

  • 验证符号,如 trainIdx 只出现在我的OpenCV4Android包含在路径和符号部分。

  • 更改我的包含在路径和符号部分。我基本上试图将OpenCV包含在开头和结尾。






一些意见



什么是不工作



我认为它是 CDT索引因为以下原因:




  • 在命令行中,我可以使用 ndk-build clean ndk-build

  • 当我启动Eclipse时,我没有任何错误,直到我打开一个C ++文件从 jni 文件夹)。

  • 我可以随时构建项目,但只要我打开了一个C ++文件,我可以由于很多 Field'< name>'无法解析,所以不再运行应用程序。

  • 如果我不要打开C ++文件,Eclipse不会报告任何错误,可以成功构建和部署Android应用程序。



有趣的事实



以下代码报告错误 queryIdx pt

  cv :: line(mRgb,keypointsA [matches [i] .queryIdx] .pt,keypointsB [matches [i] .trainIdx] .pt,cv :: Scalar(255,0,0,255),1,8,0 ); 

如果我写如下,它的作品:

  cv :: DMatch tmpMatch = matches [i]; 
cv :: KeyPoint queryKp = keypointsA [tmpMatch.queryIdx];
cv :: KeyPoint trainKp =关键点B [tmpMatch.trainIdx];
cv :: line(mRgb,queryKp.pt,trainKp.pt,cv :: Scalar(255,0,0,255),1,8,0);

这不是所有的OpenCV功能都未解决:只有 pt queryIdx trainIdx 是。


解决方案

在Eclipse环境中选择的项目首选项中,转到C / C ++一般 - >代码分析 - >启动。确保两个复选框未选中。关闭并重新打开项目或重新启动eclipse并重建项目。


NOTE: it apparently is a recurrent question on StackOverflow, but - for what I have seen - either people never find a way or their solution does not work for me

The problem:

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.

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.


What I have tried

  • 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 trainIdx only appear in my OpenCV4Android include in the Paths and Symbols section.
  • Change the order of my includes in the Paths and Symbols section. I basically tried to put the OpenCV include in the beginning and in the end.

Some observations

What is not working

I assume that it is the CDT index because of the following:

  • In command line, I can build my project using ndk-build clean and ndk-build.
  • When I start Eclipse, I have no error until I open a C++ file (from the jni folder).
  • 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.

Interesting fact

The following code reports errors on 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);

It is not that all of the OpenCV functions are unresolved: only pt, queryIdx and trainIdx are.

Any comment will be really appreciated.

解决方案

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编译成功但仍然会产生语义错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆