Structs from one header into a struct in another header
I'm having trouble on this... I have this header:
#ifndef PESSOA_H
#define PESSOA_开发者_运维技巧H
typedef struct pa{
int idade;
int atend;
}pessoa;
void inicPessoa(pessoa *ps, int id);
#endif
and, in filaC.h:
#ifndef FILAC_H
#define FILAC_H
#include "pessoa.h"
typedef struct pessoa elem_t;
typedef struct no{
elem_t info;
struct no *prox, *ant;
} No;
typedef No * Fila;
#endif
but compiler says fiel info on filaC.h has an incomplete type.
changing elem_t info;
to struct elem_t into;
had no effect.
You have no type called struct pessoa
. You have struct pa
, and you have pessoa
(a typedef).
So you need to change this:
typedef struct pessoa elem_t;
into one of:
typedef struct pa elem_t;
typedef pessoa elem_t;
精彩评论