开发者

Structs from one header into a struct in another header

开发者 https://www.devze.com 2023-03-07 10:48 出处:网络
I\'m having trouble on this... I have this header: #ifndef PESSOA_H #define PESSOA_开发者_运维技巧H

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消