The eclipse C project shows errors (Symbol cannot be resolved), but it compiles

I have access to project C at work, which I have to implement. I was able to load it in eclipse and could Project -> Build All it. Compilation does not show errors or warnings. But there are many mistakes in the eclipse. One example:


There is an enumeration

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

in one of the files. It is used somewhere else and creates the following error: enter image description here

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


I did not find a satisfactory solution for this. I already tried to include all possible directories that I could think of in Project Properties -> C/C++ General -> Paths and Symbols (for example, this post ), but this did not help.

The project itself is compiled using the Makefile (which is why I need Project -> Build All ). Could it be that the eclipse misinterprets these makefiles? I lost a little after talking with this material for several hours and did not take a single step forward.

EDIT: Here are some screenshots for my building-related project properties (at least I find them relevant: D). Tell me if you need more information.

enter image description hereenter image description here

+7
source share
4 answers

It seems that Eclipse (and not gcc) is configured to parse incorrect or some additionally obsolete (including) source files.

+1
source

Since I got an offer from moooeeeep, I will post the solution here. I still agree with the answer to alc, because it was he who showed me in the right direction.

My decision:

If I click on AM in eclipse (the one highlighted in red) and press F3 to go to the ad, he really asked me which ad I want to go to. He enumerated the (correct) constant enum, as well as some variable from another place. Therefore, the problem was that there were several AM declarations in different places in the code.

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

+1
source

An error report has been added to the Eclipse CDT Bugzilla regarding this issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=439553

+1
source

This is a pretty old question, but I hope this short answer can be useful to someone.

I had similar errors with enumerations in the IDE, but not during compilation, which seemed to indicate an error in Eclipse Codan. After upgrading to the new version of Eclipse (Neon 4.6) released in June, the bugs disappeared. Just try updating Eclipse!

+1
source

All Articles