Error: unknown type name

2

The error would give in the use as a parameter in the two methods of the character. They use the Flag Type, saying that they do not know that type.

    #ifndef __PERSONAJE_H
    #define __PERSONAJE_H
    #include <stdlib.h>
    #include <stdio.h>
    #include <time.h>
    #include "Bandera.h"
    #include "ListaPLataformas.h"
    #include "plataforma.h"
    #include "Pantalla.h"


    typedef struct PersonajeRep * Personaje;


    Personaje crea_Personaje(double x, double y,int vy,int vx );

    int actualiza_Personaje(Personaje p,ListaPlataformas l,int x_c,Bandera b,time_t* fin);
    ....
    int colisision_Bandera(Personaje p,Bandera b);

    ....


   #endif

This is the .h that creates the conflict of unknown type name "Flag". The thing is that I used to have a cyclical reference with the inclusion of headings, and I already moved the only method that made me include the character.h in Bandera.h, that method was colision_Bandera (Character p, Flag b).

So I do not know why it gives this error and I can not fix it.

Here would be the code of Bandera.h.

  #ifndef __BANDERA_H
  #define __BANDERA_H

  #include <stdlib.h>
  #include <stdio.h>
  #include "Pantalla.h"


  typedef struct BanderaRep * Bandera;

  Bandera crea_Bandera(double x, double y);


   void dibujar_Bandera(Bandera b);

   void transforma_Bandera(int x_c,Bandera b);

   double getAncho_Bandera(Bandera b);
   double getAlto_Bandera(Bandera b);
   double getX_Bandera(Bandera b);
   double getY_Bandera(Bandera b);

   void libera_Bandera(Bandera b);

   #endif

Thank you very much in advance to anyone who can help me with this error.

EDI1:

Here would be the compiler information. Or is it something else that you need?

    
asked by Juanvaquero 13.05.2017 в 14:51
source

1 answer

1
typedef struct PersonajeRep * Personaje;

To be able to define the alias Personaje a structure named PersonajeRep must be previously declared:

struct PersonajeRep
{
  // ...
};

typedef struct PersonajeRep* Personaje;

Or at least you should use declaration forward :

struct PersonajeRep;

typedef struct PersonajeRep* Personaje;

// ...

struct PersonajeRep
{
  // ...
};

And the same for Bandera . If those structures are already defined what you need is to add the corresponding #include so that the compiler can know the structure.

    
answered by 15.05.2017 в 02:27