SMAUG Undefined Reference

Posted by Robert Powell on Wed 11 Jun 2014 06:44 AM — 2 posts, 15,567 views.

Australia #0
In Mud.H


extern QUEST_DATA * questmaster;

typedef struct quest_data QUEST_DATA;

struct quest_data
{
int     level_range;
int	practice_amt;
int	practice_cost;
int	award_vnum[MAX_QDATA+1];
int	award_value[MAX_QDATA+1];
int	gold_amt;
int	gold_cost;
};


In Quest.c


void quest_list ( CHAR_DATA * ch )
{
    set_char_color ( AT_WHITE, ch );
    short i, count = 0;
    send_to_char ( "&D--------------------------------------------------------------------------------\r\n", ch );
    send_to_char ( "&cItem # Item Price \r\n", ch );
    send_to_char ( "&D--------------------------------------------------------------------------------\r\n", ch );
    for ( i = 0; i <= MAX_QDATA; i++ )
    {
        if ( questmaster->award_vnum && questmaster->award_value )
        {
            ++count;
            ch_printf ( ch, "&c[%2d] &w %-35s &c %-6s \r\n",
                        count, get_obj_index ( questmaster->award_vnum )->short_descr, num_punct ( questmaster->award_value ) );
        }
    }
    ch_printf ( ch, "&c[%2d] &w %s Gold &c 120\r\n", count + 1, num_punct ( questmaster->gold_amt ) );
    ch_printf ( ch, "&c[%2d] &w %d Practices &c %-6s\r\n", count + 2, questmaster->practice_amt, num_punct ( questmaster->practice_cost ) );
    send_to_char ( "&D--------------------------------------------------------------------------------\r\n", ch );
    send_to_char ( "&D Quest Buy # \r\n", ch );
    return;
}


Everything compiles ok, but when it links, it bugs out with the following:

/home/BLAA_BLAA/src/quest.c:1033: undefined reference to `questmaster'
/home/BLAA_BLAA/src/quest.c:1033: undefined reference to `questmaster'
/home/BLAA_BLAA/quest.c:1037: undefined reference to `questmaster'

So what did i miss, and how do i fix it. Porting old code over to run with modern compilers is a nightmare :)

Rob.
Australia #1
Dont worry, i found what I missed, left out a chunk of code from db.c that created the questmaster.

I think it is working now, I hope :)