0
我在课堂上收到的关于创建头文件的解释有些不清楚。我的教授说创建一个头文件,你想包含函数原型。我不断收到包含指针标记的函数原型的错误。 我的头文件:修复GCC头文件中的编译器错误
#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
而且我收到的错误是:
$ 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
我不是能够包括在头文件中的函数原型指针?
那些将是我的结构,那么那些需要在头文件中定义? – MacSalty
@SpaceJesus前向声明就足够了 – stefan
就是这样。太棒了!非常感谢Andy! – MacSalty