Having some trouble compiling

Posted by Toy on Wed 31 Mar 2004 09:07 AM — 4 posts, 17,636 views.

#0
Recently transferred my code from Windows to Linux, and upon recompiling I ran into this strange error:

gcc -lcrypt -o smaug act_comm.o act_info.o act_move.o act_obj.o act_wiz.o boards.o build.o clans.o comm.o comments.o const.o db.o deity.o fight.o handler.o hashstr.o ibuild.o ident.o interp.o magic.o makeobjs.o mapout.o misc.o mpxset.o mud_comm.o mud_prog.o player.o polymorph.o requests.o reset.o save.o shops.o skills.o special.o tables.o track.o update.o grub.o stat_obj.o ban.o services.o planes.o imm_host.o color.o slay.o antitank.o infochan.o charge.o sharpen.o renumber.o archery.o bank.o alias.o finger.o pfiles.o backup.o liquids.o editor.o newarena.o
act_comm.o(.text+0x2673): In function `do_tell':
/root/My Computer/My Programs/Software Development/smaug/dist/src/act_comm.c:1284: undefined reference to `log_printf'
act_comm.o(.text+0x2dc8): In function `do_reply':
/root/My Computer/My Programs/Software Development/smaug/dist/src/act_comm.c:1475: undefined reference to `log_printf'
act_comm.o(.text+0x3269): In function `do_retell':
/root/My Computer/My Programs/Software Development/smaug/dist/src/act_comm.c:1614: undefined reference to `log_printf'
act_info.o(.text+0x4643): In function `do_hedit':
/root/My Computer/My Programs/Software Development/smaug/dist/src/act_info.c:2208: undefined reference to `log_printf'
act_info.o(.text+0x4ab4): In function `do_hset':
/root/My Computer/My Programs/Software Development/smaug/dist/src/act_info.c:2321: undefined reference to `log_printf'
act_info.o(.text+0x4af3):/root/My Computer/My Programs/Software Development/smaug/dist/src/act_info.c:2322: more undefined references to `log_printf' follow
collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1
make[1]: Leaving directory `/usr/share/My Programs/Software Development/smaug/dist/src'
make: *** [all] Error 2

Anyone have any idea what's up?

-Toy
#1
QUICK SIDE NOTE:

Each section of code that is calling for log_printf, such as act_comm.c - do_reply, doesn't even have a call for log_printf.

Code for do_reply:

void do_reply( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    CHAR_DATA *victim;
    int position;
#ifndef SCRAMBLE
    int speaking = -1, lang;
	
    for ( lang = 0; lang_array[lang] != LANG_UNKNOWN; lang++ )
		if ( ch->speaking & lang_array[lang] )
		{
			speaking = lang;
			break;
		}
#endif
		
		
		xREMOVE_BIT( ch->deaf, CHANNEL_TELLS );
		if ( IS_SET( ch->in_room->room_flags, ROOM_SILENCE ) )
		{
			send_to_char( "You can't do that here.\n\r", ch );
			return;
		}
		
		if ( !IS_NPC(ch) && xIS_SET(ch->act, PLR_SILENCE) )
		{
			send_to_char( "Your message didn't get through.\n\r", ch );
			return;
		}
		
		if ( ( victim = ch->reply ) == NULL )
		{
			send_to_char( "They aren't here.\n\r", ch );
			return;
		}
		
		if ( !IS_NPC( victim ) && ( victim->switched )
			&& can_see( ch, victim ) && ( get_trust( ch ) > LEVEL_HERO ) )
		{
			send_to_char( "That player is switched.\n\r", ch );
			return;
		}
		else if ( !IS_NPC( victim ) && ( !victim->desc ) )
		{
			send_to_char( "That player is link-dead.\n\r", ch );
			return;
		}
		
		if ( !IS_NPC(victim) && xIS_SET(victim->act, PLR_AFK) )
		{
			send_to_char( "That player is afk.\n\r", ch );
			return;
		}
		
		if ( xIS_SET( victim->deaf, CHANNEL_TELLS ) 
			&& ( !IS_IMMORTAL( ch ) || ( get_trust( ch ) < get_trust( victim ) ) ) )
		{
			act( AT_PLAIN, "$E has $S tells turned off.", ch, NULL, victim,
				TO_CHAR );
			return;
		}
		
		if ( ( !IS_IMMORTAL(ch) && !IS_AWAKE(victim) )
			|| ( !IS_NPC(victim) && IS_SET( victim->in_room->room_flags, ROOM_SILENCE ) ) )
		{
			act( AT_PLAIN, "$E can't hear you.", ch, 0, victim, TO_CHAR );
			return;
		}
		
		if ( victim->desc		/* make sure desc exists first  -Thoric */
			&&   victim->desc->connected == CON_EDITING 
			&&   get_trust(ch) < LEVEL_BUILDER )
		{
			act( AT_PLAIN, "$E is currently in a writing buffer.  Please try again in a few minutes.", ch, 0, victim, TO_CHAR );
			return;
		}
		
		/* Check to see if the receiver is ignoring the sender */
		if(is_ignoring(victim, ch))
		{
			/* If the sender is an imm they cannot be ignored */
			if(!IS_IMMORTAL(ch) || get_trust(victim) > get_trust(ch))
			{
				set_char_color(AT_IGNORE, ch);
				ch_printf(ch,"%s is ignoring you.\n\r",
					victim->name);
				return;
			}
			else
			{
				set_char_color(AT_IGNORE, victim);
				ch_printf(victim, "You attempt to ignore %s, but "
					"are unable to do so.\n\r", ch->name);
			}
		}
		
		act( AT_TELL, "You tell $N '$t'", ch, argument, victim, TO_CHAR );
		position		= victim->position;
		victim->position	= POS_STANDING;
#ifndef SCRAMBLE
		if ( speaking != -1 && (!IS_NPC(ch) || ch->speaking) )
		{
			int speakswell = UMIN(knows_language(victim, ch->speaking, ch),
				knows_language(ch, ch->speaking, victim));
			
			if ( speakswell < 85 )
				act( AT_TELL, "$n tells you '$t'", ch, translate(speakswell, argument, lang_names[speaking]), victim, TO_VICT );
			else
				act( AT_TELL, "$n tells you '$t'", ch, argument, victim, TO_VICT );
		}
		else
			act( AT_TELL, "$n tells you '$t'", ch, argument, victim, TO_VICT );
#else
		if ( knows_language( victim, ch->speaking, ch ) ||
			(IS_NPC(ch) && !ch->speaking) )
			act( AT_TELL, "$n tells you '$t'", ch, argument, victim, TO_VICT );
		else
			act( AT_TELL, "$n tells you '$t'", ch, scramble(argument, ch->speaking), victim, TO_VICT );
#endif
		victim->position	= position;
		victim->reply	= ch;
		ch->retell		= victim;
		if ( IS_SET( ch->in_room->room_flags, ROOM_LOGSPEECH ) )
		{
			sprintf( buf, "%s: %s (reply to) %s.",
				IS_NPC( ch ) ? ch->short_descr : ch->name,
				argument,
				IS_NPC( victim ) ? victim->short_descr : victim->name );
			append_to_file( LOG_FILE, buf );
		}
		
		if(!IS_NPC(victim) && IS_IMMORTAL(victim) && victim->pcdata->tell_history &&
			isalpha(IS_NPC(ch) ? ch->short_descr[0] : ch->name[0]))
		{
			sprintf(buf, "%s told you '%s'\n\r",
				capitalize(IS_NPC(ch) ? ch->short_descr : ch->name),
				argument);
			
			/* get lasttell index... assumes names begin with characters */
			victim->pcdata->lt_index =
				tolower(IS_NPC(ch) ? ch->short_descr[0] : ch->name[0]) - 'a';
			
			/* get rid of old messages */
			if(victim->pcdata->tell_history[victim->pcdata->lt_index])
				STRFREE(victim->pcdata->tell_history[victim->pcdata->lt_index]);
			
			/* store the new message */
			victim->pcdata->tell_history[victim->pcdata->lt_index] =
				STRALLOC(buf);
		}
		
		return;
}


Toy
Australia Forum Administrator #2
  1. Since the error is at line act_comm.c:1284 can you show or highlight that actual line? That will give a clue.
  2. The words log_printf do not need to actually appear, as it may be a define. For example:


    #define send_to_char log_printf


    That means the error would be "log_printf undefined", however in your source you see send_to_char.
  3. I can't see log_printf in my FUSS SMAUG source at all, so is it something you added? Is it in a define like I described?


#3
Ok, I finally tracked down the issue, as odd as it was. I had tried to use Memory Macro Fix found at the Alsherok Web Page, and the lines were calling for log_printf, which is why I was receiving the odd message. Luckily I had my code zipped up, viewed the stock Memory Macros I had, and replaced what was there. After a recompile I received another weird message due to an extra 3 spaces in code.. so I backspaced 3 times, recompiled and everything is working fine. *shrugs*

-Toy