Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Changes thing
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
3
| Posted by
| Metsuro
USA (389 posts) Bio
|
| Date
| Reply #30 on Fri 11 Nov 2005 10:24 PM (UTC) |
| Message
| 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;
}
that is the function from the website samson produced which I am guessing is very close to yours. possibly not. |
Everything turns around in the end | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #31 on Fri 11 Nov 2005 10:25 PM (UTC) |
| Message
| Oh okay. Then you need to add the function prototype to the top of comm.c:
int num_changes args( ( void ) );
|
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Metsuro
USA (389 posts) Bio
|
| Date
| Reply #32 on Fri 11 Nov 2005 10:28 PM (UTC) |
| Message
| | but would i place the function in changes.c or comm.c then? |
Everything turns around in the end | | Top |
|
| Posted by
| Metsuro
USA (389 posts) Bio
|
| Date
| Reply #33 on Fri 11 Nov 2005 10:30 PM (UTC) |
| Message
| | I really need to just try things on my own, i seem to find them like that. Thank you for all your help Zeno. |
Everything turns around in the end | | Top |
|
| Posted by
| Absurd
(2 posts) Bio
|
| Date
| Reply #34 on Thu 20 Jul 2006 02:18 AM (UTC) |
| Message
| 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. | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #35 on Thu 20 Jul 2006 02:44 AM (UTC) |
| Message
| | Looks like you're defining something twice. Make sure you're not doing that. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Absurd
(2 posts) Bio
|
| Date
| Reply #36 on Thu 20 Jul 2006 03:30 AM (UTC) |
| Message
| | 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. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #37 on Thu 20 Jul 2006 03:48 AM (UTC) |
| Message
| Which file? Well the error message tells you:
/tmp/changes.c:35: multiple definition of `my_strftime'
/tmp/changes.c:35: first defined here
File changes.c, line 35.
It seems strange both definitions are in the same file, perhaps you are linking the file in twice.
It is also strange you are compiling in the /tmp directory, that is usually used for temporary files.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Palatis
(7 posts) Bio
|
| Date
| Reply #38 on Wed 23 Aug 2006 09:29 AM (UTC) |
| Message
| 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);
}
This is where mine is now:
do_look( ch, "auto" );
mail_count( ch );
if( !ch->was_in_room && ch->in_room == get_room_index( ROOM_VNUM_TEMPLE ) )
ch->was_in_room = get_room_index( ROOM_VNUM_TEMPLE );
else if( ch->was_in_room == get_room_index( ROOM_VNUM_TEMPLE ) )
ch->was_in_room = get_room_index( ROOM_VNUM_TEMPLE );
else if( !ch->was_in_room )
ch->was_in_room = ch->in_room;
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 | | Top |
|
| Posted by
| Palatis
(7 posts) Bio
|
| Date
| Reply #39 on Wed 23 Aug 2006 09:49 AM (UTC) |
| Message
| Btw i also tried right under my:
case CON_PRESS_ENTER:
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);
}
if( chk_watch( get_trust( ch ), ch->name, d->host ) ) /* --Gorog */
SET_BIT( ch->pcdata->flags, PCFLAG_WATCH );
else
REMOVE_BIT( ch->pcdata->flags, PCFLAG_WATCH );
if( ch->position == POS_MOUNTED )
ch->position = POS_STANDING;
set_pager_color( AT_PLAIN, ch );
if( xIS_SET( ch->act, PLR_RIP ) )
send_rip_screen( ch );
if( xIS_SET( ch->act, PLR_ANSI ) )
send_to_pager( "\033[2J", ch );
but it just says:
omm.c:2332: undefined reference to `num_changes'
Here's where i defined my numchanges btw,
/*
* Global variables.
*/
int num_changes args( ( void ) );
IMMORTAL_HOST *immortal_host_start; /* Start of Immortal legal domains */
IMMORTAL_HOST *immortal_host_end; /* End of Immortal legal domains */
DESCRIPTOR_DATA *first_descriptor; /* First descriptor */
DESCRIPTOR_DATA *last_descriptor; /* Last descriptor */
DESCRIPTOR_DATA *d_next; /* Next descriptor in loop */
int num_descriptors;
bool mud_down; /* Shutdown */
Near top of Comm.c
>< | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #40 on Wed 23 Aug 2006 09:11 PM (UTC) |
| Message
| OK, I tried that, and got this message:
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.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Palatis
(7 posts) Bio
|
| Date
| Reply #41 on Wed 23 Aug 2006 09:36 PM (UTC) |
| Message
| Im sorry nick, I don't understand where to put.
int num_changes( void )
{
char *test;
// yadda yadda
return today;
}
I've tried comm.c and changes.c but it just tells me errors where today; is undefined and test is an unused variable.
>.< | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #42 on Wed 23 Aug 2006 09:47 PM (UTC) |
| Message
| 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
http://david.the-haleys.org | | 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.
132,897 views.
This is page 3, subject is 3 pages long:
1
2
3
It is now over 60 days since the last post. This thread is closed.
Refresh page
top