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, 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.
 Entire forum ➜ SMAUG ➜ Compiling the server ➜ Cygwin/SWR Compiling Problem.

Cygwin/SWR Compiling Problem.

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


Posted by Maruku   (3 posts)  Bio
Date Wed 23 Jul 2003 07:23 AM (UTC)
Message
When trying to compile SWR on Cygwin, I keep getting the following error, no matter what I've been told by anyone I know.. :

make swreality
make[1]: Entering directory `/home/Adam1/swr/src'
gcc -c -g3 -Wall save.c
save.c: In function `load_char_obj':
save.c:913: warning: suggest explicit braces to avoid ambiguous `else'
save.c: In function `load_corpses':
save.c:2055: warning: assignment from incompatible pointer type
save.c:2057: dereferencing pointer to incomplete type
save.c:2059: dereferencing pointer to incomplete type
make[1]: *** [save.o] Error 1
make[1]: Leaving directory `/home/Adam1/swr/src'
make: *** [all] Error 2

If anyone can help, thanks a lot!
Top

Posted by Nick Gammon   Australia  (23,057 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 23 Jul 2003 07:42 AM (UTC)
Message
It is hard to debug from just the error messages. Can you post the 10 lines preceding line 2059 in save.c, and indicate which are lines 2055, 2057 and 2059?

- Nick Gammon

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

Posted by Maruku   (3 posts)  Bio
Date Reply #2 on Wed 23 Jul 2003 08:03 PM (UTC)
Message
void load_corpses( void )
{
DIR *dp;
struct direct *de;
extern FILE *fpArea;
extern char strArea[MAX_INPUT_LENGTH];
extern int falling;

if ( !(dp = opendir(CORPSE_DIR)) )
{
bug( "Load_corpses: can't open CORPSE_DIR", 0);
perror(CORPSE_DIR);
return;
}

falling = 1; /* Arbitrary, must be >0 though. */
while ( (de = readdir(dp)) != NULL )
{
if ( de->d_name[0] != '.' )
{
sprintf(strArea, "%s%s", CORPSE_DIR, de->d_name );
fprintf(stderr, "Corpse -> %s\n", strArea);
if ( !(fpArea = fopen(strArea, "r")) )
{
perror(strArea);
continue;
}
for ( ; ; )
{
char letter;
char *word;

letter = fread_letter( fpArea );
if ( letter == '*' )
{
fread_to_eol(fpArea);
continue;
}
if ( letter != '#' )
{
bug( "Load_corpses: # not found.", 0 );
break;
}
word = fread_word( fpArea );
if ( !str_cmp(word, "CORPSE" ) )
fread_obj( NULL, fpArea, OS_CORPSE );
else if ( !str_cmp(word, "OBJECT" ) )
fread_obj( NULL, fpArea, OS_CARRY );
else if ( !str_cmp( word, "END" ) )
break;
else
{
bug( "Load_corpses: bad section.", 0 );
break;
}
}
fclose(fpArea);
}
}
fpArea = NULL;
strcpy(strArea, "$");
closedir(dp);
falling = 0;
return;
}


Line 2055: while ( (de = readdir(dp)) != NULL )
Line 2057: if ( de->d_name[0] != '.' )
Line 2059: sprintf(strArea, "%s%s", CORPSE_DIR, de->d_name );
Top

Posted by Nick Gammon   Australia  (23,057 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 23 Jul 2003 10:00 PM (UTC)
Message
Do you have this line near the start of save.c, without any #ifdef around it?


  #include <dirent.h>


If not, put it there. If there is an #ifdef remove it. ie, change:


#ifndef WIN32
  #include <dirent.h>
#endif


to


  #include <dirent.h>

- Nick Gammon

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

Posted by Maruku   (3 posts)  Bio
Date Reply #4 on Wed 23 Jul 2003 10:43 PM (UTC)
Message
Ack.. tried that, and still got the same error. Thanks anyway Nick!
Top

Posted by Nick Gammon   Australia  (23,057 posts)  Bio   Forum Administrator
Date Reply #5 on Thu 24 Jul 2003 02:58 AM (UTC)
Message
I got it to compile under Cygwin by adding one line. This is what the start of save.c looks like for me ...


#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
#include "mud.h"

#define direct dirent  // add this line


- Nick Gammon

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

Posted by GuidoHC   (10 posts)  Bio
Date Reply #6 on Tue 21 Aug 2007 04:26 AM (UTC)
Message
Nick, you are a genious! I been scrounging over these forums for a fix, and you had it!
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.


18,769 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.