In C, a line starting with // is a comment, meaning that it doesn't affect the program. When Nick put in "// yadda yadda" he was basically saying "...". The full function, as he said, is earlier in the thread; here it is:
int num_changes( void )
{
char *test;
int today;
int i;
i = 0;
test = current_date();
today = 0;
for ( i = 0; i < maxChanges; i++)
if (!str_cmp(test,changes_table[i].date))
today++;
return today;
}
It might help you a lot to google for a beginner's C tutorial. A lot of these problems and concepts are covered and it will help you a great deal to have an understanding of the basics; it's not that hard to get just a start and the benefit for you will be very great.
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
o/comm.o(.text+0x49f7): In function `nanny':
/home/nick/smaugfuss/src/comm.c:2319: undefined reference to `num_changes'
collect2: ld returned 1 exit status
Now the important thing about this message is it is a linker error, not a compiler error. If it was a compiler error it would look like this (I omitted the prototype line to cause this message):
comm.c: In function `nanny':
comm.c:2318: warning: implicit declaration of function `num_changes'
The difference tells us what to do. Simply moving the code around won't solve the linker error. The link error means it cannot find the implementation of num_changes. The compile error means it cannot find the prototype (definition) of num_changes. There is a big difference.
This is the prototype (which you have used correctly):
int num_changes args( ( void ) );
The implementation is this part (shown earlier in this thread):
int num_changes( void )
{
char *test;
// yadda yadda
return today;
}
You need to check that:
You have put this code into a file somewhere
That file is part of the project - that is, it is being linked in.
Well it works but when players log in it doesn't show.
I was wondering, where is a good place to stick this code in:
i = num_changes();
if( i > 0 )
{
send_to_desc_color ( "&RThere have been &G%d&R change(s) to the MUD today. &WType &z'&YCHANGES&z'&W to view them.\n\r", d );
send_to_char(buf, ch);
}
i = num_changes();
if( i > 0 )
{
send_to_desc_color ( "&RThere have been &G%d&R change(s) to the MUD today. &WType &z'&YCHANGES&z'&W to view them.\n\r", d );
send_to_char(buf, ch);
}
break;
}
return;
}
But it doesn't seem to compile there.
In some area's it says:
comm.c:2538: undefined reference to `num_changes'
But the area's i can put it in ( right enter press [ENTER] to get in the mud )
It doesn't show. I want it to show right after you auto look in the game. Help? xD :P
How would I go about checking\finding the duplicates? Which files might they be located in? I don't understand how this could of happened if I followed everything correctly.
I just recently installed this and got numerous errors. I followed the readme and also the changes made on page 1. Here's the error.
o/changes.o(.text+0x0): In function `my_strftime':
/tmp/changes.c:35: multiple definition of `my_strftime'
o/changes.o(.text+0x0):/tmp/changes.c:35: first defined here
o/changes.o(.text+0x1b): In function `load_changes':
/tmp/changes.c:40: multiple definition of `load_changes'
o/changes.o(.text+0x1b):/tmp/changes.c:40: first defined here
o/changes.o(.text+0x151): In function `current_date':
/tmp/changes.c:73: multiple definition of `current_date'
o/changes.o(.text+0x151):/tmp/changes.c:73: first defined here
o/changes.o(.text+0x17f): In function `save_changes':
/tmp/changes.c:83: multiple definition of `save_changes'
o/changes.o(.text+0x17f):/tmp/changes.c:83: first defined here
o/changes.o(.text+0x284): In function `delete_change':
/tmp/changes.c:109: multiple definition of `delete_change'
o/changes.o(.text+0x284):/tmp/changes.c:109: first defined here
o/changes.o(.text+0x418): In function `do_addchange':
/tmp/changes.c:147: multiple definition of `do_addchange'
o/changes.o(.text+0x418):/tmp/changes.c:147: first defined here
o/changes.o(.text+0x57e): In function `do_addimmchange':
/tmp/changes.c:191: multiple definition of `do_addimmchange'
o/changes.o(.text+0x57e):/tmp/changes.c:191: first defined here
o/changes.o(.text+0x6bc): In function `do_chedit':
/tmp/changes.c:229: multiple definition of `do_chedit'
o/changes.o(.text+0x6bc):/tmp/changes.c:229: first defined here
o/changes.o(.text+0x8fe): In function `do_changes':
/tmp/changes.c:319: multiple definition of `do_changes'
o/changes.o(.text+0x8fe):/tmp/changes.c:319: first defined here
Any suggestions or a solution on how to fix this would be appreciated.
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.