views:

78

answers:

2

The following code (a function prototype):

void parse_ini(FSFILE *fp, void(*secFunc)(char*), void(*varFunc)(char*, char*));

presents errors when compiled:

util\setup.c:38: error: syntax error before '*' token
util\setup.c:38: error: 'parse_ini' declared as function returning a function
util\setup.c:38: error: syntax error before 'void'
util\setup.c:50: error: syntax error before '*' token

What is causing this? Using MPLAB C30, which is a version of GCC v3.23 for PIC24F/dsPIC 16-bit microcontrollers.

+7  A: 

I'd guess that you haven't included a header that declares/defines FSFILE.

Michael Burr
Thanks this was the right answer and code now compiles. :)
Thomas O
+2  A: 

try this

typedef void (*varfuncptr)(char *, char*);
typedef void (*secfuncptr)(char *);

void parse_ini(FSFILE *fp, secfuncptr *secFunc, varfuncptr *varFunc);
tommieb75
Don't you have an extra set of *'s there?
aib
This is a workaround rather than a fix, and as aib said, you screwed it up.
R..
And it still doesn't work because the bug is forgetting to define `FSFILE`.
R..