Register forum user name Search FAQ

Gammon Forum

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 ➜ Compiling the server ➜ Bank code errors on compiling

Bank code errors on compiling

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Gareth   (4 posts)  Bio
Date Thu 05 Jun 2003 12:24 AM (UTC)
Message
first a great thank you to everyone helping with code,
i finally got my compile working.. but now.. i cant seem
to get this bank snippet to work, i believe its samsons
bank code

I tried three times, clean... same errors
if you need more details please let me know


bank.c: In function `find_banker':
bank.c:52: parse error before "break"
bank.c: In function `do_balance':
bank.c:207: warning: unused variable `found'
make[1]: *** [bank.o] Error 1
make[1]: Leaving directory `/cygdrive/c/smaug'
make: *** [all] Error 2

Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #1 on Thu 05 Jun 2003 03:47 AM (UTC)
Message
It's usually safe to assume that on errors that give line numbers, posting what those lines of code are, would be benefitial to your cause.

Due to the nature of your errors I'll see if I can help you out. The first one, in bank.c look at line 51. Is this part of a 'case' statement or an 'if' statement? If it's part of a case/switch block of code then line 51 is likely missing a ; at the end. If it's a line that begins with 'if' it could be a number of things, but check the number of parenthesis there's like a ( or a ) missing in the statement. Considering the error I can assume that if it IS an 'if' statement it's missing a ) at the end. If this doesn't help post lines 50-55.

The second error is a very simple one to "fix". There's an additional variable not being used, 'found', remove it ;-)
Top

Posted by Gareth   (4 posts)  Bio
Date Reply #2 on Thu 05 Jun 2003 01:43 PM (UTC)
Message
Hi, I am more of a writer/designer than a programmer, so you'll have to forgive me, i guess i should turn over all
this to my coder but hes a continent away and i want to do it now ;)

here are the offending lines: break error


for ( banker = ch->in_room->first_person; banker; banker = banker->next_in_room )
if ( IS_NPC( banker ) && xIS_SET( banker->act, ACT_BANKER )
break;

return banker;

and the 'found'

void do_balance( CHAR_DATA *ch, char *argument )
{
CHAR_DATA *banker;
char buf [MAX_STRING_LENGTH];
bool found = FALSE;

the problem is that the bank.c is unmodified by me and im sure samson would not have distributed snippets with code errors in, so i'm assuming the errors are because of other depencies...

thanks again for any advice
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #3 on Thu 05 Jun 2003 11:57 PM (UTC)

Amended on Fri 06 Jun 2003 12:06 AM (UTC) by Boborak

Message
Quote:
..and im sure samson would not have distributed snippets with code errors in..

Assumptions can get you in sticky situations...

We're all prone to mistakes, and sometimes the more skilled you are, the more 'little' mistakes you make. These errors ARE such, little mistakes.

If you review what I first posted and review what you posted, things tend to fit together.

I said:
Quote:
..look at line 51..

Since you knew how to find the offending line, I know you can determine that this is line 51:
if ( IS_NPC( banker ) && xIS_SET( banker->act, ACT_BANKER )


I then said:
Quote:
If it's a line that begins with 'if' it could be a number of things, but check the number of parenthesis there's like a ( or a ) missing in the statement. Considering the error I can assume that if it IS an 'if' statement it's missing a ) at the end.


Now I admit I didn't flat out say "Add a ) to the end and recompile, but I did hint at it pretty throughly.

Let me correct that problem. On line 51 of the code, add a ) to the end, creating this:
if ( IS_NPC( banker ) && xIS_SET( banker->act, ACT_BANKER ) )

Ok, error #2. I said:
Quote:
The second error is a very simple one to "fix". There's an additional variable not being used, 'found', remove it.

Seems simple enough.. let me clarify.

Remove this line from the code:
bool found = FALSE;


Save. Quit. Recompile.
I'm quite certain Samson posts code on his site contributed by others. He does this as a favor to both the coder and the community. So, this code is not necessarily his. And as I mentioned earlier, even the most skilled coders tend to make simple mistakes ;-)
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #4 on Fri 06 Jun 2003 12:07 AM (UTC)
Message
Hey Nick, my last post seemed to double any linebreak I added. Kinda strange. I don't remember it doing that before.
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #5 on Fri 06 Jun 2003 01:16 AM (UTC)
Message
You mean in the code snippets? I haven't changed it, but I noticed a similar problem in the help pages.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #6 on Fri 06 Jun 2003 01:48 AM (UTC)

Amended on Fri 06 Jun 2003 01:50 AM (UTC) by Boborak

Message
Yea, it did it in the quote blocks too. I adjusted my post to make it appear normal by cutting out some of the returns.

Just an idea, perhaps something was changed on the server regarding php? Not the webpages, but the server software itself. *shrug*
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #7 on Fri 06 Jun 2003 06:36 AM (UTC)
Message
Yes, that wouldn't surprise me.

I'll have to take a closer look at how I render the code blocks, it is probably something to do with that.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Samson   USA  (683 posts)  Bio
Date Reply #8 on Mon 09 Jun 2003 03:31 AM (UTC)
Message
Back to the subject of the bank code for a sec, thanks for reporting on that bug guys. Was indeed one of those silly things that just didn't get noticed. What surprises me is that it took so long before someone noticed it. Had been on the page for nearly 6 months like that :P

Also appreciate the kind comments, those are welcome indeed and are all too often missed in the day to day. Thanks :)
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.


22,793 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.