MacSalty
MacSalty

Reputation: 1242

Fixing compiler error in GCC with header file

The explanation I've received in class for creating a header file was somewhat unclear. My professor said that creating a header file, you want to include the function prototypes. I keep getting errors with my function prototypes containing pointer tokens. My header file:

#ifndef A3_H
#define A3_H

void list_init(record_list*);
void list_destroy(record_list*);
int  list_insert(record_list*, const record*);
int input_record(record*);

#endif

And the errors I'm receiving is:

$ gcc -ansi -W -Wall -pedantic -c a3.c
In file included from a3.c:4:0:
a3.h:4:27: error: expected ‘)’ before ‘*’ token
a3.h:5:30: error: expected ‘)’ before ‘*’ token
a3.h:6:29: error: expected ‘)’ before ‘*’ token
a3.h:7:24: error: expected ‘)’ before ‘*’ token

Am I not able to include pointers in function prototypes in a header file?

Upvotes: 0

Views: 299

Answers (1)

Andy Lester
Andy Lester

Reputation: 93636

Yes, you can have pointers in the header file, but it looks like you haven't defined record or record_list anywhere.

Upvotes: 5

Related Questions