2012-11-25 42 views
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 

我不是能夠包括在頭文件中的函數原型指針?

回答

5

是的,你可以在頭文件中有指針,但看起來你沒有在任何地方定義recordrecord_list

+0

那些將是我的結構,那麼那些需要在頭文件中定義? – MacSalty

+0

@SpaceJesus前向聲明就足夠了 – stefan

+0

就是這樣。太棒了!非常感謝Andy! – MacSalty