This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: "Incomplete type" and "redefinition" errors in gcc
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Ashutosh Dixit <ddixitt at yahoo dot com>
- Cc: gcc at gcc dot gnu dot org, gcc-help at gcc dot gnu dot org, Richard dot Earnshaw at arm dot com
- Date: Mon, 24 Nov 2003 15:56:34 +0000
- Subject: Re: "Incomplete type" and "redefinition" errors in gcc
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> 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
All of these diagnostics are correct. You can't repeat typedefs, and you
can't instantiate a forward declaration of an enum.
R.