29 Jan, 2010, Crelin wrote in the 21st comment:
Votes: 0
Quote
If I remember right, didn't you have to move defines around in header files or something as well? To be compliant in GCC4 that is. There were a few things that were interesting.


Yes, you have to move some things in the tables.h file but that's explained I believe in the very first post of this thread.
16 Mar, 2010, Enildo wrote in the 22nd comment:
Votes: 0
Trying to compile ROM on FC12.

$ make -f Makefile.linux 
gcc -c -Wall -O -g special.c
special.c: In function spec_string:
special.c:1037: error: subscripted value is pointer to function
make: *** [special.o] Error 1


Any advice? I'm a Java/Ruby/Python coder, C quite frankly freaks me out!
16 Mar, 2010, David Haley wrote in the 23rd comment:
Votes: 0
You need to show us the line of code in question. It looks like it's a fairly basic syntax error, though it's hard to tell how to correct it without the context.
16 Mar, 2010, Enildo wrote in the 24th comment:
Votes: 0
char *spec_string( SPEC_FUN *fun )	/* OLC */
{
int cmd;

for ( cmd = 0; spec_table[cmd].function[0] != '\0'; cmd++ ) //This is line 1037
if ( fun == spec_table[cmd].function )
return spec_table[cmd].name;

return 0;
}


From what I can guess, this function tries to iterate over all the functions in the spec_table array and match the name of the one that you passed in. I tried changing function[0] to just function and it compiled, but I severely doubt that is correct code.

Also, I get the same error elsewhere in the code after I 'fix' this part.

Finally, when linking the final executable I have the following trace:

gcc -O -g -o rom act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o
alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o handler.o healer.o
interp.o note.o lookup.o magic.o magic2.o music.o recycle.o save.o scan.o skills.o
special.o tables.o update.o -lcrypt
comm.o: In function `game_loop_unix':
/path/to/Rom24/src/comm.c:787: undefined reference to `string_add'
/path/to/Rom24/src/comm.c:792: undefined reference to `run_olc_editor'
handler.o: In function `material_name':
/path/to/Rom24/src/handler.c:126: undefined reference to `material_type'
handler.o: In function `material_lookup':
/path/to/Rom24/src/handler.c:114: undefined reference to `material_type'
/path/to/Rom24/src/handler.c:114: undefined reference to `material_type'
interp.o:(.rodata+0x1678): undefined reference to `do_olc'
interp.o:(.rodata+0x1690): undefined reference to `do_aedit'
interp.o:(.rodata+0x16a8): undefined reference to `do_redit'
interp.o:(.rodata+0x16c0): undefined reference to `do_medit'
interp.o:(.rodata+0x16d8): undefined reference to `do_oedit'
interp.o:(.rodata+0x16f0): undefined reference to `do_asave'
interp.o:(.rodata+0x1708): undefined reference to `do_alist'
interp.o:(.rodata+0x1720): undefined reference to `do_resets'
collect2: ld returned 1 exit status
make: *** [rom] Error 1


I'm ready to give up. All you have to say is "give up" and I will totally give up.
16 Mar, 2010, David Haley wrote in the 25th comment:
Votes: 0
Where did you get this code? I'm a little surprised that you're getting these problems: based on what you're telling me, this code should never have compiled.
16 Mar, 2010, Runter wrote in the 26th comment:
Votes: 0
spec_table[cmd].function[0] should be spec_table[cmd].function for one thing.
16 Mar, 2010, Deimos wrote in the 27th comment:
Votes: 0
Enildo said:
I tried changing function[0] to just function and it compiled, but I severely doubt that is correct code.

That's what I was going to tell you to do until I read your post. To tell you if it's correct or not, I'd need to see spec_table's declaration
16 Mar, 2010, Davion wrote in the 28th comment:
Votes: 0
for ( cmd = 0; spec_table[cmd].function != NULL; cmd++ )


I think gcc3 was a little easier on casting. I've seen some codebases use,
if( command == "immtalk" )

…and it work, simply because behind the scenes literal constants of the same value are shared. Who knows what mystery allowed that to compile and pass as probably only a warning.

But that'd crash for sure if function was NULL!
16 Mar, 2010, Enildo wrote in the 29th comment:
Votes: 0
David Haley said:
Where did you get this code? I'm a little surprised that you're getting these problems: based on what you're telling me, this code should never have compiled.


I got the code from this here website, Rom24b6OLC.tar.gz

spec_table[cmd].function != NULL


The offending src file compiled after changing this line, but I'm still having the linking problems I've added olc.o and string.o to the O_FILES line, which now reads:

O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \
alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \
handler.o healer.o interp.o lookup.o magic.o magic2.o music.o note.o \
olc.o recycle.o save.o scan.o skills.o special.o string.o tables.o \
update.o


This seems to have fixed some of the problems (like `string_add' and `run_olc_editor'), but now the screen scrolls with all of the functions of olc.o whose definitions aren't found:
olc.o:(.rodata+0x208): undefined reference to `aedit_age'
olc.o:(.rodata+0x218): undefined reference to `aedit_builder'
olc.o:(.rodata+0x238): undefined reference to `aedit_create'
olc.o:(.rodata+0x248): undefined reference to `aedit_file'
olc.o:(.rodata+0x258): undefined reference to `aedit_name'
olc.o:(.rodata+0x268): undefined reference to `aedit_reset'
…etc


Anyways, I think I'm going to try the stock ROM 2.4b6 from the hypercube site
16 Mar, 2010, Enildo wrote in the 30th comment:
Votes: 0
Yup, screw OLC….I got the stock ROM running on FC12 after doing the table.h hack mentioned in the first post of this thread. Up and running in 5 minutes!

Thanks for the help all, maybe someone should take a look at that file that's posted in the repo section here?
16 Mar, 2010, Davion wrote in the 31st comment:
Votes: 0
The code I uploaded doesn't have OLC!

[link=file]914[/link]

This will compile cleanly on gcc 4.4.1 on x86 and 64bit compilers.
26 Jul, 2010, Rarva.Riendf wrote in the 32nd comment:
Votes: 0
How could I participate in cleaning this code (or more likely commenting the code so every basic problems is known) ?
26 Jul, 2011, melopene wrote in the 33rd comment:
Votes: 0
Rarva.Riendf said:
How could I participate in cleaning this code (or more likely commenting the code so every basic problems is known) ?


If you'll write em up, I'll be happy to add any new notes on updated compilers, or anything for that matter, to the ROM FAQ (which really needs some updating anyway).
27 Jul, 2011, Rarva.Riendf wrote in the 34th comment:
Votes: 0
Sent you a PM with what I could remember.
20.0/34