25 Feb, 2011, thalor wrote in the 1st comment:
Votes: 0
Hi I'm getting an error from the stock Lola codebase that I cannot see the problem with. I've managed to fix several other ones, but this one has me confused as to why it's popping up.

The error I get is:

gcc -Wall -g -DLINUX    -c -o language.o language.c
language.c: In function `translate':
language.c:293: parse error before `static'
make: *** [language.o] Error 1


Here is the code it is referring to: Can anyone spot what I'm not seeing?

char *translate (CHAR_DATA *ch, char *text)
{
static char text2[MAX_STRING_LENGTH];
char *pName;
int iSyl;
int length;
int speak;

speak = (IS_NPC(ch) ? race_table[ch->race].language : ch->pcdata->speak);


static const struct syl_type syl_table[] =
{


Thanks!
25 Feb, 2011, Scandum wrote in the 2nd comment:
Votes: 0
You could try changing:
int speak;

speak = (IS_NPC(ch) ? race_table[ch->race].language : ch->pcdata->speak);


to

int speak = (IS_NPC(ch) ? race_table[ch->race].language : ch->pcdata->speak);


If that's not the problem I'm out of ideas.
25 Feb, 2011, thalor wrote in the 3rd comment:
Votes: 0
Thanks!
25 Feb, 2011, Runter wrote in the 4th comment:
Votes: 0
Looks like its related to assignment in declarations section (other than initialization). I've seen some compiles requiring that.
25 Feb, 2011, Kaz wrote in the 5th comment:
Votes: 0
In C, declarations (including definitions that have assignments) in a function must all come before statements. Your "speak = blah" line is not a declaration, so you may not declare anything else after that. Hence why the suggested fix worked: by making them all into declarations.
25 Feb, 2011, Vigud wrote in the 6th comment:
Votes: 0
In C89, declarations in a function must all come before statements. In C99 they don't.
0.0/6