This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

"Incomplete type" and "redefinition" errors in gcc


Hi,

If I compile the following simple C code with gcc:
________________try.c________________________

typedef enum VIDF VIDF;
typedef unsigned int U32;
typedef unsigned int U32;

typedef struct VIDR
{
  VIDF VidF;
  U32  width;
} VIDR;

typedef enum VIDF
{
  aVIDF,
  bVIDF
} VIDF;

int main( void )
{
  return 0;
}
____________________________________________

I get the following errors:

bash-2.05b$ gcc try.c
try.c:3: error: redefinition of `U32'
try.c:2: error: `U32' previously declared here
try.c:7: error: field `VidF' has incomplete type
try.c:15: error: redefinition of `VIDF'
try.c:1: error: `VIDF' previously declared here
______________________________________________

I would have thought that the code would compile
without errors. Are these bugs or features of gcc (or
of the C language standard) and are there any options
to make these errors disappear?

The preceding is only sample code. In the real code
which I am trying to compile, making changes to take
care of these errors will be very cumbersome.
I am using gcc 3.3.1 on Cygwin.

Thanks very much for your help.

Ashutosh


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]