eclipse C project shows errors (Symbol could not be resolved) but it compiles

I have got access to a C project at work that I have to implement some stuff in. I was able to load it into eclipse and can Project -> Build All it. Compilation shows no errors or warnings. But in eclipse, there are a lot of errors shown. One example:


There is an enum

typedef enum MeasurementType {
    PN, BB, AM, RES
} MEAS_TYPE;
MEAS_TYPE type;

in one of the files. It is used somewhere else and produces an error like this:

It is most interesting, that only AM seems to be a problem, not PN or BB .


I haven't found a satisfying solution to this. I already tried to include all possible directories I could think of in Project Properties -> C/C++ General -> Paths and Symbols (like this post suggests), but that didn't help.

The project itself is compiled with Makefiles (which is why I need Project -> Build All ). Can it be that eclipse does not interpret those Makefiles correctly or something? I am a bit lost after messing around with that stuff for a few hours and not getting a single step forward.

EDIT: Here are some screenshots for my build-relevant project properties (at least I believe they are relevent :D). Tell me if you need more information.

在这里输入图像描述


它看起来好像Eclipse(而不是gcc)被设置为解析错误的或者一些额外的,可过时的(包含)源文件。


Since I got a suggestion from moooeeeep, I will post the solution here. I am still accepting alk's answer, because he was the one that showed me towards the right direction.

My solution:

If I click on AM in eclipse (the one that is underlined with red) and press F3 to go to the declaration, it actually asked me to which declaration I want to go. It listed the (correct) enum constant as well as some variable from somewhere else. Therefore the problem was that multiple declarations of AM were present in different code locations.

I fixed this problem by just renaming the enum constant to something else ( AN in my case). There is no variable with the same name in the code and therefore eclipse was able to refactor it correctly.


在Eclipse CDT Bugzilla中添加了一个关于这个问题的bug报告:https://bugs.eclipse.org/bugs/show_bug.cgi?id=439553

链接地址: http://www.djcxy.com/p/65722.html

上一篇: 在R中列表中的每个元素中添加新值?

下一篇: 日食C项目显示错误(符号无法解析),但它编译