Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Unresolved symbol yet again but in a new flavour (Juno)(Symbol defined twice but protected by #ifndef)
icon5.gif  Unresolved symbol yet again but in a new flavour (Juno) [message #899020] Mon, 30 July 2012 04:07
cdt discovery is currently offline cdt discovery
Messages: 10
Registered: July 2012
Junior Member
I'm also getting an unresolved symbol error, but it seems quite different to what I have found so far.

One header file (let's call it edec.h) declares an enum
#ifndef EDEC_H
#define EDEC_H

typedef enum
{
  ENTRY_1,
  ENTRY_2
} Something;

...

#endif


This header file (please ignore the architectural side to this!) gets copied (not included!) into two other header files:

a.h:
#ifndef EDEC_H
#define EDEC_H

typedef enum
{
  ENTRY_1,
  ENTRY_2
} Something;

...

#endif

...


b.h:
#ifndef EDEC_H
#define EDEC_H

typedef enum
{
  ENTRY_1,
  ENTRY_2
} Something;

...

#endif

...


The two header files have some lines in common (as a copied header) but also differ in other lines.

Now I have a source file including a.h and b.h indirectly via other header files. Both include files are in the same include path (which is part of the C file's entry-tab (Properties -> C/C++ General -> Preprocessor, Include Paths, Macros, etc.).
Search for unresolved includes returns no entry to this file.

Within this C File the enum entry ENTRY_1 is used and underlined red. The error message states, that "Symbol 'ENTRY_1' could not be resolved" and the type is "Semantic Error".

When pressing F3 (Open Declaration) while selecting ENTRY_1, Eclipse offers me both locations (a.h and b.h), which to me looks like it knows where to find it, it just doesn't know which one to take.
I would have thought that, once the index is built, it automatically defines EDEC_H the first time it is encountered and ignores the second definition.

Any help is highly appreciated as this is causing heaps of CODAN errors!
(Deactivating unresolved symbols is not an option.)
Previous Topic:Juno CDT discovery not working
Next Topic:how to stop building during building process in eclipse IDE
Goto Forum:
  


Current Time: Thu Jul 24 02:35:47 EDT 2014

Powered by FUDForum. Page generated in 0.01424 seconds