smaug tables.c

Posted by Frobozz on Wed 17 Nov 2004 04:27 PM — 14 posts, 42,934 views.

#0
Every time I try to add something to tables.c I get an error message similar to this (this is actually what I just recieved while adding a liquid mixing command)... What am I missing?

tables.c: In function `skill_function':
tables.c:349: `do_liquid' undeclared (first use in this function)
tables.c:349: (Each undeclared identifier is reported only once
tables.c:349: for each function it appears in.)
tables.c: In function `skill_name':
tables.c:949: `do_liquid' undeclared (first use in this function)
make[1]: *** [o/tables.o] Error 1
make: *** [all] Error 2

I appreciate the help.
USA #1
Did you declare the function in the main header file, and do a clean compile?
#2
Ok, I fixed that error (thanks) but of course another error popped up. This is what my make all looks like:

[frobozz@bb7 src]$ make clean
rm -f o/*.o smaug *~
[frobozz@bb7 src]$ make all
make -s smaug
Compiling o/imc.o....
Compiling o/i3.o....
Compiling o/act_comm.o....
Compiling o/act_info.o....
Compiling o/act_move.o....
Compiling o/act_obj.o....
Compiling o/act_wiz.o....
Compiling o/ban.o....
Compiling o/boards.o....
Compiling o/build.o....
Compiling o/clans.o....
Compiling o/color.o....
Compiling o/comm.o....
Compiling o/comments.o....
Compiling o/const.o....
Compiling o/db.o....
Compiling o/deity.o....
Compiling o/fight.o....
Compiling o/handler.o....
Compiling o/hashstr.o....
Compiling o/hotboot.o....
Compiling o/imm_host.o....
Compiling o/interp.o....
Compiling o/liquids.o....
Compiling o/magic.o....
Compiling o/makeobjs.o....
Compiling o/mapout.o....
Compiling o/md5.o....
Compiling o/misc.o....
Compiling o/mpxset.o....
Compiling o/mud_comm.o....
Compiling o/mud_prog.o....
Compiling o/planes.o....
Compiling o/player.o....
Compiling o/polymorph.o....
Compiling o/reset.o....
Compiling o/save.o....
Compiling o/services.o....
Compiling o/shops.o....
Compiling o/skills.o....
Compiling o/special.o....
Compiling o/tables.o....
Compiling o/track.o....
Compiling o/update.o....
o/liquids.o: In function `do_drink':
/home/frobozz/smaug/src/liquids.c:1213: undefined reference to `do_quaff'
o/tables.o: In function `skill_function':
/home/frobozz/smaug/src/tables.c:262: undefined reference to `do_eat'
/home/frobozz/smaug/src/tables.c:346: undefined reference to `do_light'
/home/frobozz/smaug/src/tables.c:499: undefined reference to `do_pull'
/home/frobozz/smaug/src/tables.c:502: undefined reference to `do_push'
/home/frobozz/smaug/src/tables.c:508: undefined reference to `do_quaff'
/home/frobozz/smaug/src/tables.c:516: undefined reference to `do_rap'
/home/frobozz/smaug/src/tables.c:523: undefined reference to `do_recite'
/home/frobozz/smaug/src/tables.c:599: undefined reference to `do_smoke'
/home/frobozz/smaug/src/tables.c:622: undefined reference to `do_tamp'
o/tables.o: In function `skill_name':
/home/frobozz/smaug/src/tables.c:873: undefined reference to `do_eat'
/home/frobozz/smaug/src/tables.c:946: undefined reference to `do_light'
/home/frobozz/smaug/src/tables.c:1090: undefined reference to `do_pull'
/home/frobozz/smaug/src/tables.c:1093: undefined reference to `do_push'
/home/frobozz/smaug/src/tables.c:1097: undefined reference to `do_quaff'
/home/frobozz/smaug/src/tables.c:1103: undefined reference to `do_rap'
/home/frobozz/smaug/src/tables.c:1110: undefined reference to `do_recite'
/home/frobozz/smaug/src/tables.c:1184: undefined reference to `do_smoke'
/home/frobozz/smaug/src/tables.c:1205: undefined reference to `do_tamp'
collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1
#3
By the way, thanks to everyone that's been putting up with these really newbish questions. It's been 6 years since I learned to code on smaug and Im just coming back to it from a total absence.

I appreciate it greatly.

Amended on Wed 17 Nov 2004 06:59 PM by Frobozz
USA #4
Hmm, do you have misc.c? That seems to be where all those functions are located? Make sure they are all declared in the main header file too.
Australia Forum Administrator #5
It needs to know the declaration for do_quaff (amongst others). For me that is in mud.h, eg.

DECLARE_DO_FUN( do_quaff );


You need to confirm that line is in mud.h, and that mud.h is included into tables.c. Ditto for the other ones.
#6
since do_quaff was one of the "errors" I found this in misc.c:


void do_quaff( CHAR_DATA *ch, char *argument )

{
OBJ_DATA *obj;
ch_ret retcode;
bool hgflag = TRUE;

if ( argument[0] == '\0' || !str_cmp(argument, "") )
{
send_to_char( "Quaff what?\n\r", ch );
return;
}

if ( (obj = find_obj(ch, argument, TRUE)) == NULL )
return;

if ( !IS_NPC(ch) && IS_AFFECTED( ch, AFF_CHARM) )
return;

if ( obj->item_type != ITEM_POTION )
{
if ( obj->item_type == ITEM_DRINK_CON )
do_drink( ch, obj->name );
else
{
act( AT_ACTION, "$n lifts $p up to $s mouth and tries to drink from it...", ch, obj, NULL, TO_ROOM );
act( AT_ACTION, "You bring $p up to your mouth and try to drink from it...", ch, obj, NULL, TO_CHAR );
}
return;
}

Thoughts?
#7
"It needs to know the declaration for do_quaff (amongst others). For me that is in mud.h, eg.

DECLARE_DO_FUN( do_quaff );


You need to confirm that line is in mud.h, and that mud.h is included into tables.c. Ditto for the other ones.
"

Yep they are all in mud.h

And mud.h is in tables.c

#include <time.h>
#include <stdio.h>
#include <string.h>
#include "mud.h"
Amended on Wed 17 Nov 2004 07:56 PM by Frobozz
USA #8
Well you included it in the Makefile because I see it compiled. Have you tried a clean compile? And is misc.c included in mud.h?
#9
When I grep for them this is the result:

grep do_eat *.c
misc.c: void do_eat( CHAR_DATA *ch, char *argument )
tables.c if ( !str_cmp( name, "do_eat" )) return do_eat;
tables.c: if ( skill == do_eat )
return "do_eat";

grep do_quaff *.c
liquids.c: do_quaff( ch, obj->name );
misc.c: do_quaff( ch, obj->name );
misc.c: void do_quaff( CHAR_DATA *ch, char *argument )
tables.c: if ( !str_cmp( name, "do_quaff" )) return do_quaff;
tables.c: if ( skill == do_quaff ) return "do_quaff";

USA #10
When you were adding liquids, was it a snippet by chance? If so, did it say to add something like:

#ifndef LIQUIDSYSTEM

in misc.c?

If so, go through and make sure do_drink, do_fill, and do_empty all are within the #ifndef LIQUIDSYSTEM and #endif brackets. No other functions should be in there. If other functions reside in there, they will not be "defined" as your compiler is stating, as LIQUIDSYSTEM is defined.
Amended on Wed 17 Nov 2004 10:08 PM by Nick Cash
#11
o/misc.o: In function `do_empty':
/home/frobozz/smaug/src/misc.c:1549: multiple definition of `do_empty'
o/liquids.o:/home/frobozz/smaug/src/liquids.c:1755: first defined here
/usr/bin/ld: Warning: size of symbol `do_empty' changed from 1438 to 1454 in o/misc.o
collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1
make: *** [all] Error 2

I've gotten rid of all the errors but that. I dont understand it, I cant find where it's duplicated or how to get rid of it.

Ideas?
USA #12
Looks to me like you dont have the do_empty function withing the #ifndef LIQUIDSYSTEM and #endif statements in misc.c
#13
I got it! WOO. My problem came from me being too overeager with this code, I changed it from being just two liquids into one new one into multiple (3,4,5,and 6) into one.. I got sloppy. Im a dumb law student.

Thank you for all your help.