1

i am trying to use a structure defined in a header file but the structure isnt recognized by gcc. I have searched for similar problems but none of the solutions has worked...

this is the header file code:

#ifndef _HTTPLIB_H_
#define _HTTPLIB_H_


#include <stdio.h>

typedef struct req_buffer{
  char* page;
  int type; //1 - html, 2 - comp
  int socket;
  Req_buffer * next;
  time_t conn_time,response_time;
}Req_buffer;

#endif

and the error is:

unknown type name 'Req_buffer'

1 Answers1

1

Req_buffer *next; you are referencing the symbol Req_buffer before it gets declared. try to change it into:

struct req_buffer* next;
A.S.H
  • 29,101
  • 5
  • 23
  • 50