[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  smaug tables.c
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

smaug tables.c

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Frobozz   (75 posts)  [Biography] bio
Date Wed 17 Nov 2004 04:27 PM (UTC)
Message
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.
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #1 on Wed 17 Nov 2004 05:24 PM (UTC)
Message
Did you declare the function in the main header file, and do a clean compile?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Frobozz   (75 posts)  [Biography] bio
Date Reply #2 on Wed 17 Nov 2004 06:48 PM (UTC)
Message
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
[Go to top] top

Posted by Frobozz   (75 posts)  [Biography] bio
Date Reply #3 on Wed 17 Nov 2004 06:53 PM (UTC)

Amended on Wed 17 Nov 2004 06:59 PM (UTC) by Frobozz

Message
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.

[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #4 on Wed 17 Nov 2004 07:09 PM (UTC)
Message
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.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Wed 17 Nov 2004 07:26 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Frobozz   (75 posts)  [Biography] bio
Date Reply #6 on Wed 17 Nov 2004 07:28 PM (UTC)
Message
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?
[Go to top] top

Posted by Frobozz   (75 posts)  [Biography] bio
Date Reply #7 on Wed 17 Nov 2004 07:53 PM (UTC)

Amended on Wed 17 Nov 2004 07:56 PM (UTC) by Frobozz

Message
"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"
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #8 on Wed 17 Nov 2004 07:57 PM (UTC)
Message
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?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Frobozz   (75 posts)  [Biography] bio
Date Reply #9 on Wed 17 Nov 2004 07:59 PM (UTC)
Message
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";

[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Reply #10 on Wed 17 Nov 2004 10:04 PM (UTC)

Amended on Wed 17 Nov 2004 10:08 PM (UTC) by Nick Cash

Message
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.

~Nick Cash
http://www.nick-cash.com
[Go to top] top

Posted by Frobozz   (75 posts)  [Biography] bio
Date Reply #11 on Thu 18 Nov 2004 02:35 AM (UTC)
Message
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?
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Reply #12 on Thu 18 Nov 2004 02:48 AM (UTC)
Message
Looks to me like you dont have the do_empty function withing the #ifndef LIQUIDSYSTEM and #endif statements in misc.c

~Nick Cash
http://www.nick-cash.com
[Go to top] top

Posted by Frobozz   (75 posts)  [Biography] bio
Date Reply #13 on Thu 18 Nov 2004 03:07 AM (UTC)
Message
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.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


5,906 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]