[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  Compiling the server
. . -> [Subject]  Problems Compiling

Problems Compiling

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


Posted by Kelven   (10 posts)  [Biography] bio
Date Sun 02 Sep 2001 10:43 PM (UTC)
Message
I downloaded Smaug1.4a for Windows from this site, and it doesn't seem to want to compile.

I am attempting to compile it with Cygwin beta19.
I've used this version of Cygwin to compile a ported version of smaug1.4 many times before without any trouble.

With the smaug1.4a for Win32 that I've downloaded from Nick Gammon's site, it gives me a few parse errors. I've looked over the code and I honestly can't see why it's giving me those errors. I am not the best coder, however, so I'm probably missing something.

I thought I'd ask for help here first since this is where I got the code.

The error appears in interp.c at 1192 and 1197
1192: parse error before '<'
1197: parse error before 'if'

The code:

1187 void update_userec(struct timeval *time_used, struct 1188 timerset *userec)
1189 {
1190 userec->num_uses++;
1191 if ( !timerisset(&userec->min_time)
1192 || timercmp(time_used, &userec->min_time, <) )
1193 {
1194 userec->min_time.tv_sec = time_used->tv_sec;
1195 userec->min_time.tv_usec = time_used->tv_usec;
1196 }
1197 if ( !timerisset(&userec->max_time)
1198 || timercmp(time_used, &userec->max_time, >) )
1199 {
1200 userec->max_time.tv_sec = time_used->tv_sec;
1201 userec->max_time.tv_usec = time_used->tv_usec;
1202 }
1203 userec->total_time.tv_sec += time_used->tv_sec;
1204 userec->total_time.tv_usec += time_used->tv_usec;
1205 while ( userec->total_time.tv_usec >= 1000000 )
1206 {
1207 userec->total_time.tv_sec++;
1208 userec->total_time.tv_usec -= 1000000;
1209 }
1210 return;
1211 }

If anyone can help me, I'd really appreciate it. Thanks :)
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 02 Sep 2001 10:52 PM (UTC)

Amended on Sun 02 Sep 2001 10:53 PM (UTC) by Nick Gammon

Message
There is a solution to this in another post. It is handy when you have a query like that to use the search feature (at the bottom of each page) and try searching for keywords which seem relevant to your problem.

In this case keywords would be "interp.c and timercmp" so you could put that into the search.

The first results returned when I did that mentions a change to interp.c relating to time, namely:


In interp.c:



#define __rtems__ // <--- Add this
#include <time.h> // <--- before this line


What this effectively does is add a "define" for "timercmp" which lets it process the offending line correctly.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Kelven   (10 posts)  [Biography] bio
Date Reply #2 on Sun 02 Sep 2001 11:04 PM (UTC)
Message
Hmm, I added that line and it gives me the same error.

Could it be because of the compiler I'm using? I read that you compiled this code successfully with MS C++ 6.0.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Sun 02 Sep 2001 11:09 PM (UTC)

Amended on Sun 02 Sep 2001 11:10 PM (UTC) by Nick Gammon

Message
Those instructions were for Cygwin, not MS C++.

Make sure you put the line in exactly (copy and paste). That is two underscores on each side, not one.

Also, it has to go before the include mentioned, or nothing will happen.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Kelven   (10 posts)  [Biography] bio
Date Reply #4 on Sun 02 Sep 2001 11:17 PM (UTC)
Message
It was inserted exactly as written.
I read in a previous post that Smaug1.4a Win32 shouldn't be compiled with Cygwin, that the Smaug1.4a for Unix will work when compiled with Cygwin.

Perhaps I should try to compile 1.4a Unix instead?
[Go to top] top

Posted by Kelven   (10 posts)  [Biography] bio
Date Reply #5 on Sun 02 Sep 2001 11:21 PM (UTC)
Message
Downloaded and tried the non-win port of 1.4a, exact same problem (even after I changed the code)

It appears 1.4a doesn't like me.

Perhaps because I've been on rot muds for the past year, I've made all smaug codebases hate me :\
[Go to top] top

Posted by Kelven   (10 posts)  [Biography] bio
Date Reply #6 on Mon 03 Sep 2001 04:36 PM (UTC)
Message
Can anyone help? I tried compiling both 1.4a Win32 and 1.4a Unix with cygwin, both give me the same error (even after I change the code to how Nick stated above)

Is there another copy of smaug 1.4a that can compile with cygwin successfully that I could get?

I don't mean to be a pest, I just want to be able to compile 1.4a with cygwin.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Tue 04 Sep 2001 04:33 AM (UTC)
Message
Try this.

Change directory to /usr/include/sys and edit the file time.h.

At around line 83, change it like this:


/* BSD time macros used by RTEMS code */
//#if defined(__rtems__)
#if 1

/* Convenience macros for operations on timevals.
NOTE: `timercmp' does not work for >= or <=. */
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)



This will force the timer macros (eg. timercmp) to be compiled in.



- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


16,351 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]