Parse error

Posted by Nick Cash on Sat 03 May 2003 12:02 AM — 4 posts, 16,850 views.

USA #0
I'm getting this error:


gcc -c -g3 -Wall -DIMC -DIMCSMAUG imc.c
In file included from mud.h:56,
from imc.c:68:
imc.h:602: parse error before `ch'
imc.h:605: parse error before `ch'
imc.h:606: parse error before `ch'
imc.h:607: parse error before `ch'
imc.h:608: parse error before `ch'
make[1]: *** [imc.o] Error 1

Anyways, I know thats not very specific, but I was wondering if you might point me to where to look to fix the parse error, or even telling me what a parse error really is. All of my experience in my past with parse errors just usually turned out to be something like a small spelling error or such. Anyways, if you want to see lines 602-608 of imc.h then I'll post it, just ask. As always, thanks for all the help.
USA #1
This caught my eye: "In file included from mud.h:56"
this suggests you have #include "imc.h" at almost the very top of your mud.h. If this is the case, then I can assume lines 602, 605, ect. are something like (CHAR_DATA *ch, ). The compiler is giving you a syntax error because CHAR_DATA has yet to be declared. Try moving the #include call way below the CHAR_DATA declaration, around line 300 should do, and then try a recompile.

A syntax error is when the compiler receives something it's not expecting. For example, the compiler expects most commands to end in a ; if you had the following lines:

temp = 5
temp2 = 6;

You would get a syntax error on the first line, because the compiler is expecting a ; it did not receive. On the same note:

void (CHAR_DATA *ch, int bleh );
void (ASDFASDJF *ch, int bleh );

Are seen as the same thing by the compiler if CHAR_DATA had not been declared. A jumble of letters.

Hope this helps.
USA #2
Thanks, works fine now. :) Thanks for helping me improve upon my knowledge of coding also.
USA #3
No problem. Every little bit helps. Many times I learn something myself when helping others out, so it's a win-win situation. ;-)