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 ➜ Please help, Smaug win32 to Linux

Please help, Smaug win32 to Linux

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


Posted by Lothios   USA  (7 posts)  Bio
Date Wed 23 Oct 2002 03:49 AM (UTC)
Message
Hello

I have searched the forums for information about porting smaug back to linux, the only thing I found stated that it would work as long as WIN32 was not defined. Not sure where or if there is a definition stating the system type ( I have been unable to find it ).

Anyway, I have made many changes to the source and do not wish to start over now that I have a linux box. Everything was compiling fine with VC++ 6 on my XP pro computer.

Nick I was hoping you could help me out, I hate to ask this of you but the past week has left me without any options and feeling quite desperate.

Any input would be GREATLY appreciated.
I am currently running Slackware Linux 8.1

Here are the errors:

gcc -c -O -g3 -Wall -Wuninitialized -DSMAUG -DREGEX act_comm.c
In file included from act_comm.c:32:
mud.h:866: parse error before `|'
mud.h:866: stray '\' in program
mud.h:873: warning: type defaults to `int' in declaration of `to_types'
mud.h:873: warning: data definition has no type or storage class
mud.h:3155: parse error before `do'
mud.h:3155: stray '\' in program
mud.h:3156: stray '\' in program
mud.h:3157: stray '\' in program
mud.h:3158: stray '\' in program
mud.h:3159: stray '\' in program
mud.h:3160: parse error before string constant
mud.h:3160: warning: type defaults to `int' in declaration of `fprintf'
mud.h:3160: warning: data definition has no type or storage class
mud.h:3160: stray '\' in program
mud.h:3161: warning: type defaults to `int' in declaration of `abort'
mud.h:3161: conflicting types for `abort'
/usr/include/stdlib.h:561: previous declaration of `abort'
mud.h:3161: warning: data definition has no type or storage class
mud.h:3161: stray '\' in program
mud.h:3162: parse error before `}'
mud.h:3162: stray '\' in program
mud.h:3166: stray '\' in program
mud.h:3167: stray '\' in program
mud.h:3168: stray '\' in program
mud.h:3169: stray '\' in program
mud.h:3170: stray '\' in program
mud.h:3171: parse error before string constant
mud.h:3171: warning: type defaults to `int' in declaration of `fprintf'
mud.h:3171: warning: data definition has no type or storage class
mud.h:3171: stray '\' in program
mud.h:3172: warning: type defaults to `int' in declaration of `abort'
mud.h:3172: warning: data definition has no type or storage class
mud.h:3172: stray '\' in program
mud.h:3173: parse error before `}'
mud.h:3173: stray '\' in program
mud.h:3178: stray '\' in program
mud.h:3179: stray '\' in program
mud.h:3180: stray '\' in program
mud.h:3181: stray '\' in program
mud.h:3182: stray '\' in program
mud.h:3183: parse error before string constant
mud.h:3183: warning: type defaults to `int' in declaration of `fprintf'
mud.h:3183: warning: data definition has no type or storage class
mud.h:3183: stray '\' in program
mud.h:3184: stray '\' in program
mud.h:3185: stray '\' in program
mud.h:3186: warning: type defaults to `int' in declaration of `point'
mud.h:3186: warning: initialization makes integer from pointer without a cast
mud.h:3186: warning: data definition has no type or storage class
mud.h:3186: stray '\' in program
mud.h:3187: parse error before `}'
mud.h:3194: stray '\' in program
mud.h:3195: stray '\' in program
mud.h:3196: stray '\' in program
mud.h:3197: stray '\' in program
mud.h:3198: stray '\' in program
mud.h:3199: parse error before string constant
mud.h:3199: warning: type defaults to `int' in declaration of `fprintf'
mud.h:3199: warning: data definition has no type or storage class
mud.h:3199: stray '\' in program
mud.h:3200: stray '\' in program
mud.h:3201: stray '\' in program
mud.h:3202: stray '\' in program
mud.h:3203: warning: type defaults to `int' in declaration of `point'
mud.h:3203: redefinition of `point'
mud.h:3186: `point' previously defined here
mud.h:3203: warning: initialization makes integer from pointer without a cast
mud.h:3203: warning: data definition has no type or storage class
mud.h:3203: stray '\' in program
mud.h:3204: parse error before `}'
mud.h:3225: stray '\' in program
mud.h:3226: stray '\' in program
mud.h:3227: stray '\' in program
mud.h:3228: stray '\' in program
mud.h:3229: stray '\' in program
mud.h:3230: stray '\' in program
mud.h:3231: parse error before `->'
mud.h:3231: stray '\' in program
mud.h:3232: parse error before `->'
mud.h:3232: stray '\' in program
mud.h:3233: warning: type defaults to `int' in declaration of `last'
mud.h:3233: warning: initialization makes integer from pointer without a cast
mud.h:3233: warning: data definition has no type or storage class
.
etc ( same errors )
.
make[1]: *** [act_comm.o] Error 1
make[1]: Leaving directory `/home/rage/smaug/src'
make: *** [all] Error 2


Lothios
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 23 Oct 2002 04:13 AM (UTC)

Amended on Wed 23 Oct 2002 04:14 AM (UTC) by Nick Gammon

Message
Your problem here is the line endings. Grab the utility dos2unix from my downloads area and run on your source files, then it should get a lot less errors.

eg. (from Windows):


dos2unix *.c
dos2unix *.h


Alternatively you can do it from inside Unix by typing this:


perl -pi -e 's/^M//g' *.c
perl -pi -e 's/^M//g' *.h


Note that to get the "^M" above you have to type Ctrl+V Ctrl+M

Another approach again is to "ftp" the files from your Windows PC to your Unix PC in text mode. That should fix up the line endings as they are copied.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Wed 23 Oct 2002 04:15 AM (UTC)
Message
As for the WIN32 define, just make sure you do NOT say, on the command line:

-DWIN32

The -D is a "define".

For example, by saying:

-DSMAUG -DREGEX

you are defining SMAUG and REGEX.

- Nick Gammon

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

Posted by Lothios   USA  (7 posts)  Bio
Date Reply #3 on Wed 23 Oct 2002 06:04 AM (UTC)
Message


Thank you! That did help it get through much more than before. I used your perl commands. I did run into another problem and was wondering if it may be due to the same thing ( even though I did the perl command again just for this file: mapout.c )

gcc -c -O -g3 -Wall -Wuninitialized -DSMAUG -DREGEX mapout.c
mapout.c:55: parse error before `byte'
mapout.c:56: parse error before `byte'
mapout.c:57: parse error before `byte'
mapout.c:208: parse error before `byte'
mapout.c: In function `draw_map':
mapout.c:217: `map' undeclared (first use in this function)
mapout.c:217: (Each undeclared identifier is reported only once
mapout.c:217: for each function it appears in.)
mapout.c:220: warning: unreachable code at beginning of switch statement
mapout.c:275: `ch' undeclared (first use in this function)
mapout.c: In function `do_lookmap':
mapout.c:479: `byte' undeclared (first use in this function)
mapout.c:479: parse error before `map'
mapout.c:499: `map' undeclared (first use in this function)
mapout.c: At top level:
mapout.c:510: parse error before `byte'
mapout.c: In function `CheckRoom':
mapout.c:514: `CX' undeclared (first use in this function)
mapout.c:514: `CY' undeclared (first use in this function)
mapout.c:516: `location' undeclared (first use in this function)
mapout.c:516: `map' undeclared (first use in this function)
mapout.c:512: warning: `PosX' might be used uninitialized in this function
mapout.c:512: warning: `PosY' might be used uninitialized in this function
mapout.c: At top level:
mapout.c:542: parse error before `byte'
mapout.c: In function `CheckExitDir':
mapout.c:546: `location' undeclared (first use in this function)
mapout.c:546: `ExD' undeclared (first use in this function)
mapout.c:549: `map' undeclared (first use in this function)
mapout.c:549: `X' undeclared (first use in this function)
mapout.c:549: `Y' undeclared (first use in this function)
make[1]: *** [mapout.o] Error 1
make[1]: Leaving directory `/home/rage/smaug/src'
make: *** [all] Error 2

Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #4 on Wed 23 Oct 2002 09:46 AM (UTC)
Message
Try posting mapout.c, lines 50 to 60 (indicating which is which). Could be you used something that is in the Windows libraries that is not identical on Unix. Shouldn't be too hard to fix.

- Nick Gammon

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

Posted by Lothios   USA  (7 posts)  Bio
Date Reply #5 on Wed 23 Oct 2002 06:08 PM (UTC)
Message
50>int num_rooms_avail (CD * ch);
51>int add_new_room_to_map (CD * ch, MID * map, int row, int col, int proto_room, char code);
52>int number_to_room_num(int array_index);
53>int char_to_number (char code);
54>int exit_lookup (int vnum1, int vnum2);
55>void draw_map (CHAR_DATA *ch, byte map[50][50]);
56>void CheckRoom(ROOM_INDEX_DATA *location, int PosX, int PosY, byte map[50][50]);
57>void CheckExitDir(ROOM_INDEX_DATA *location, int PosX, int PosY, int Exd, byte map[50][50]);
58>int center, MapDiameter;
59>char *you_are_here (int row, int col, char *map);
60>char get_map_code( RID *room, int mode );
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Wed 23 Oct 2002 11:25 PM (UTC)
Message
'byte' is used a bit in Windows, but I don't think is standard in the Unix .h files.

Try adding this to a central spot, eg. mud.h:

typedef unsigned char byte;


- Nick Gammon

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

Posted by Lothios   USA  (7 posts)  Bio
Date Reply #7 on Wed 23 Oct 2002 11:59 PM (UTC)
Message
That appears to of worked. I noticed you made a function called RENAME to act like the unix rename. Is there anything I need to do with this because I keep getting:
( Thank you again, I beleve this will be the last item =)

act_info.o: In function `do_hset':
/home/rage/smaug/src/act_info.c:2373: undefined reference to `RENAME'
act_wiz.o: In function `do_balzhur':
/home/rage/smaug/src/act_wiz.c:3398: undefined reference to `RENAME'
act_wiz.o: In function `do_mortalize':
/home/rage/smaug/src/act_wiz.c:5096: undefined reference to `RENAME'
act_wiz.o: In function `do_destroy':
/home/rage/smaug/src/act_wiz.c:5973: undefined reference to `RENAME'
/home/rage/smaug/src/act_wiz.c:6001: undefined reference to `RENAME'
act_wiz.o:/home/rage/smaug/src/act_wiz.c:10532: more undefined references to `RENAME' follow
collect2: ld returned 1 exit status

Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #8 on Thu 24 Oct 2002 03:02 AM (UTC)
Message
Try:

#define RENAME rename

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


25,813 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.