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 ➜ SMAUG coding ➜ Compile error

Compile error

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


Posted by Robert Powell   Australia  (367 posts)  Bio
Date Sun 22 Feb 2004 07:50 AM (UTC)

Amended on Sun 22 Feb 2004 07:53 AM (UTC) by Robert Powell

Message
I just payed for some hosting and upploaded my source and tryed to compile and got the following errors, i have know idea why this would happen but im guessing it has something to do with the compilers, im using the latest mandrake and the server is redhat, any assistance would be great. Oh they say that they have these copmpilers C/C++ Compiler: gcc 2.95.3 & gcc 3.3


locker.c:145: parse error befor `if'
locker.c:145 stray '\' in program



#if defined(KEY)
#undef KEY
#endif

#define KEY( literal, field, value )     \
				if ( !str_cmp( word, literal ) ) \
				{					\
				    field  = value;   \
				    fMatch = TRUE;   \
				    break;    \
				}

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #1 on Sun 22 Feb 2004 08:23 AM (UTC)
Message
Sounds like it might be from somewher above that, as I can't see anything wrong with what you have. You can try to simply put it all on one line, it looks ugly, but it may work.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Robert Powell   Australia  (367 posts)  Bio
Date Reply #2 on Sun 22 Feb 2004 09:03 AM (UTC)
Message
here is a few lines above it


	fclose( fp );

        /* Total the weight of the contents */
        for( obj = ch->in_room->first_content; obj; obj = obj->next_content )
        {
            locker->holding = locker->holding + ( obj->weight * obj->count );
        }
    }
    
    return locker;
}


Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
Top

Posted by Robert Powell   Australia  (367 posts)  Bio
Date Reply #3 on Sun 22 Feb 2004 09:18 AM (UTC)
Message
Would you beleive that i managed to fix it, it was spitting the dummy over the final } not having a backslash on it.

Thanks grevem for making me give it some pretty formatting

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #4 on Sun 22 Feb 2004 11:46 PM (UTC)
Message
You need to be cautious with the backslashes. You shouldn't need one on the last line, however more importantly, you must not follow them by a space.

eg.


#define blah blah \
  blah


will work, but


#define blah blah \(space here)
  blah


Will not work.

- Nick Gammon

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

Posted by Robert Powell   Australia  (367 posts)  Bio
Date Reply #5 on Mon 23 Feb 2004 08:28 AM (UTC)
Message
thanks nick for the clarification, i went back into my source backups and found that i had an errent <space bar> or 3 heh, as i do all of my coding locally, i missed this problem as my compiler seems to not be bothered by such slackness(even if the crappy code was written my resort mud). My host seems to be a lot more strict with the code tho, which i guess can only mean that i will hopefully crash less from my own sloppyness.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
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.


15,834 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.