Problem with Fingerfiles

Posted by Firedraconian on Fri 30 Jul 2004 08:41 PM — 19 posts, 79,449 views.

USA #0
I keep getting an error when I try to clean it up and compile it so that it will work:

player.o(.text+0x78a3): In function 'do_homepage':
/home/nick/smaug/dist/src/player.c:1501:multiple definition of '_do_homepage'
finger.o(.text+0x16cf):/home/nick/smaug/dist/src/finger.c:476: first defined here
collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1
make[1]: Leaving directory '/home/nick/smaug/dist/src'
make: *** [all] Error 2

The only time the finger-command snippet mentions finger.c is when it says, "5. In player.c, find and comment out the function do_homepage." I don't think I'm doing that right.

Unfortunately, this is my first time coding, and I have no idea what most of this stuff means that coders take for granted, like when it goes, 'take this and put it in the appropriate spot'. What exactly do they mean by commenting it out? Putting # marks in front of everything, like this:?

#void do_title( CHAR_DATA *ch, char *argument )
USA #1
First of all, you should try learn more about coding :-)

secondly, to comment out a function would be like this:

/*
void do_homepage

blah blah
code
blah blah

*/

and then paste the new function. the /* to */ will comment out anything in between those two brackets. use them wisely ;)

**********************************************************

This will be a good starting point. You seem to know a little bit, but here is this just in case. also you can search yahoo and google for help with coding.

http://www.gammon.com.au/smaug/howtocompile.htm

have fun.
Amended on Fri 30 Jul 2004 09:41 PM by Ithildin
USA #2
/* You'll see comments like this all throughout the code */ In a .c or an .h file, when you 'comment out' a piece of code, you simply insert this /* at the beginning and this */ at the end so the compiler treats the entire section as a comment instead of code. # is used in the makefile to comment lines out, apparently.
USA #3
yea, the # comments out in the makefile, not in the code itself.

you can also just comment out one line of code using this:

//this line will be commented out

so you can either use /* and */ for a bunch of lines of code or // for one line of code.
Canada #4
Note though, that the // style commenting is technically C++ commenting, and you might get some warnings about // comments, depending on what compiler flags your using.
USA #5
Okay, it worked. :) Yay.

New problem. For some reason, even though I have ansi turned on, the colours aren't showing up. -_-

It appears like this:

&w Finger Info
-----------
&wName : &GLordrom &wMUD Age: &G1620
&wLevel : &G65 &w Class: &GWarrior
&wSex : &GMale &w Race : &GHuman
&wTitle :&G the Spell Student
&wHomepage: &G
&wEmail : &G
&wICQ# : &G0
&wLast on : &GFri Jul 30 20:42:39 2004

And I keep getting this bug:
Log: [*****] BUG: Figure_color: color 2592 invalid.

(Edit): Also, I can't get the new commands to save. If I do, cedit save, it doesn't work.

cedit save
Log: Lordrom: cedit save
Command: save
Level: 0
Position: 0
Log: 0
Code: do_save
Flags:
Amended on Sat 31 Jul 2004 01:27 AM by Firedraconian
Canada #6
what functions displaying it? If its something like write_to_buffer, then you will see the color codes.
USA #7
1) What?

2) How would I fix that?

3) How do I fix the cedit thing so the command actually saves?
USA #8
3.) You're doing save wrong. Its "cedit save cmdtable" as the helpfile... doesn't say, heh.
USA #9
Naturally. ;)

I don't suppose you know how to fix the colour codes so they work, eh?
USA #10
Stock Smaug doesn't do colors like that, you have to do things like:

set_char_color( AT_GOLD, ch )


Unless you know how to allow color symbols. There should be a post on that here, somewhere.
Canada #11
In your finger code, look in the do_finger, and see what function is being used to display that info.
USA #12
I'm not sure what color modifications you have done, so hopefully this isn't redundant but open smaug\dist\doc\FAQ and implement sections 12-a, b and c. I think you are using smaug1.4a_mxp, so your version should be 12-f compliant already. Stock SMAUG is only partially color - enabled because of certain reasons. Just a caveat tho; there are still some minor color bugs I haven't seen definitive solutions for, i.e., inconsistent color strings ( bright green, dark green, when only &G is used ), duplicate strings persisting after FAQ-12-f compliance, etc... Anyway, getting kosher with section 12 will get you to 90% color compatability, which is better than it ships, eh? :) Hope that helps, and if anyone else knows why duplicate strings appear even w/ the 12-f fix implemented, I'd like to know, myself.
USA #13
Okay, I can't get that to work. I tried it and everytime I try to recompile, it gives me about ten pages of "undefined reference to '_send_to_pager'" and "undefined reference to '_send_to_char'".

I thought that that's what the

#define send_to_char send_to_char_color
#define send_to_pager send_to_pager_color

things were for. I tried both putting them under the #endif in mud.h and just above it, and I keep getting the same error messages.
USA #14
Did you also comment out the functions like it said to do?
USA #15
Also, don't forget to make clean or delete all the object files in smaug\dist\src. In Cygwin, you can type rm *.o then make. You should always do that whenever you edit a file w/ an '.h' suffix, just in case you didn't do that -- I don't sometimes, its easy to forget. That could cause an undefined reference error if you don't make clean.
USA #16
I removed both player.o and comm.o before I tried to make it, and it still gave the eight-million reference errors.

I commented them out so they looked like this:

/*
* Write to one char.
*/
/*
void send_to_char( const char *txt, CHAR_DATA *ch )
{
if ( !ch )
{
bug( "Send_to_char: NULL *ch" );
return;
}
if ( txt && ch->desc )
write_to_buffer( ch->desc, txt, strlen(txt) );
return;
}
*/

/*
* Same as above, but converts &color codes to ANSI sequences..


and:

/*
void send_to_pager( const char *txt, CHAR_DATA *ch )
{
if ( !ch )
{
bug( "Send_to_pager: NULL *ch" );
return;
}
if ( txt && ch->desc )
{
DESCRIPTOR_DATA *d = ch->desc;

ch = d->original ? d->original : d->character;
if ( IS_NPC(ch) || !IS_SET(ch->pcdata->flags, PCFLAG_PAGERON) )
{
send_to_char(txt, d->character);
return;
}
write_to_pager(d, txt, 0);
}
return;
}
*/


The bottom of mud.h is:

*/

#define exit(arg) Win32_Exit(arg)
void Win32_Exit(int exit_code);
#define send_to_char send_to_char_color
#define send_to_pager send_to_pager_color


#endif
USA #17
Looks like you commented correctly, at least as compared to how I did it. Try adding the defines after the endif in mud.h then remember to <return> and leave at least one blank line after the last define. Then, just to be safe, rm *.o to remove all object files before doing your make. You never know what other files may be linked even if you didn't alter them. It adds another minute to the compiling process, but lets you be sure -- worth the time, imho. Other than that, it looks like you're on the right track.
USA #18
Jeeze, thank you thank you thank you. It works. For now. *cough*