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 ➜ ROM ➜ Compiling the server ➜ Compiling Rot2.0wolc on gcc 4

Compiling Rot2.0wolc on gcc 4

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


Posted by Cresus   (3 posts)  Bio
Date Fri 12 Apr 2019 01:51 AM (UTC)
Message
I've read to the forums and fixed some of the problems in merc.h and tables.h to move things around, now i get this error

[slowlane@condor src]$ make
gcc -c -Wall -O3 -g bit.c
bit.c:53: error: initializer element is not constant
bit.c:53: error: (near initialization for ‘flag_stat_table[0].structure’)
bit.c:54: error: initializer element is not constant
bit.c:54: error: (near initialization for ‘flag_stat_table[1].structure’)
bit.c:55: error: initializer element is not constant
bit.c:55: error: (near initialization for ‘flag_stat_table[2].structure’)
bit.c:56: error: initializer element is not constant
bit.c:56: error: (near initialization for ‘flag_stat_table[3].structure’)
bit.c:57: error: initializer element is not constant
bit.c:57: error: (near initialization for ‘flag_stat_table[4].structure’)
bit.c:58: error: initializer element is not constant
bit.c:58: error: (near initialization for ‘flag_stat_table[5].structure’)
bit.c:59: error: initializer element is not constant
bit.c:59: error: (near initialization for ‘flag_stat_table[6].structure’)
bit.c:60: error: initializer element is not constant
bit.c:60: error: (near initialization for ‘flag_stat_table[7].structure’)
bit.c:61: error: initializer element is not constant
bit.c:61: error: (near initialization for ‘flag_stat_table[8].structure’)
bit.c:62: error: initializer element is not constant
bit.c:62: error: (near initialization for ‘flag_stat_table[9].structure’)
bit.c:63: error: initializer element is not constant
bit.c:63: error: (near initialization for ‘flag_stat_table[10].structure’)
bit.c:64: error: initializer element is not constant
bit.c:64: error: (near initialization for ‘flag_stat_table[11].structure’)
bit.c:65: error: initializer element is not constant
bit.c:65: error: (near initialization for ‘flag_stat_table[12].structure’)
bit.c:66: error: initializer element is not constant
bit.c:66: error: (near initialization for ‘flag_stat_table[13].structure’)
bit.c:67: error: initializer element is not constant
bit.c:67: error: (near initialization for ‘flag_stat_table[14].structure’)
bit.c:71: error: initializer element is not constant
bit.c:71: error: (near initialization for ‘flag_stat_table[15].structure’)
bit.c:72: error: initializer element is not constant
bit.c:72: error: (near initialization for ‘flag_stat_table[16].structure’)
bit.c:73: error: initializer element is not constant
bit.c:73: error: (near initialization for ‘flag_stat_table[17].structure’)
bit.c:74: error: initializer element is not constant
bit.c:74: error: (near initialization for ‘flag_stat_table[18].structure’)
bit.c:75: error: initializer element is not constant
bit.c:75: error: (near initialization for ‘flag_stat_table[19].structure’)
bit.c:76: error: initializer element is not constant
bit.c:76: error: (near initialization for ‘flag_stat_table[20].structure’)
bit.c:77: error: initializer element is not constant
bit.c:77: error: (near initialization for ‘flag_stat_table[21].structure’)
bit.c:78: error: initializer element is not constant
bit.c:78: error: (near initialization for ‘flag_stat_table[22].structure’)
bit.c:79: error: initializer element is not constant
bit.c:79: error: (near initialization for ‘flag_stat_table[23].structure’)
bit.c:80: error: initializer element is not constant
bit.c:80: error: (near initialization for ‘flag_stat_table[24].structure’)
bit.c:81: error: initializer element is not constant
bit.c:81: error: (near initialization for ‘flag_stat_table[25].structure’)
bit.c:82: error: initializer element is not constant
bit.c:82: error: (near initialization for ‘flag_stat_table[26].structure’)
make: *** [bit.o] Error 1

bit.c lines are as follows:
const struct flag_stat_type flag_stat_table[] =
{
/* { structure stat }, */
{ area_flags, FALSE },
{ sex_flags, TRUE },
{ exit_flags, FALSE },
{ door_resets, TRUE },
{ room_flags, FALSE },
{ sector_flags, TRUE },
{ type_flags, TRUE },
{ extra_flags, FALSE },
{ wear_flags, FALSE },
{ act_flags, FALSE },
{ affect_flags, FALSE },
{ apply_flags, TRUE },
{ wear_loc_flags, TRUE },
{ wear_loc_strings, TRUE },
{ container_flags, FALSE },

/* ROM specific flags: */

{ form_flags, FALSE },
{ part_flags, FALSE },
{ ac_type, TRUE },
{ size_flags, TRUE },
{ position_flags, TRUE },
{ off_flags, FALSE },
{ imm_flags, FALSE },
{ res_flags, FALSE },
{ vuln_flags, FALSE },
{ weapon_class, TRUE },
{ weapon_type2, FALSE },
{ apply_types, TRUE },
{ 0, 0 }
};

Did I blow something up when I changed the merc.h tables to

extern const struct flag_type * area_flags;

from
extern const struct flag_type area_flags[];

-Thanks I'm trying ot remember stuff from long ago as my daughters are interested in coding. I'd like ot show them some times and they can see changes.
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #1 on Fri 12 Apr 2019 02:19 AM (UTC)

Amended on Fri 12 Apr 2019 02:20 AM (UTC) by Fiendish

Message
Quote:
Compiling Rot2.0wolc

Uh huh. Link to your code files and also link to the originals so that we can see what you've changed and what the original looks like.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Cresus   (3 posts)  Bio
Date Reply #2 on Fri 12 Apr 2019 03:34 AM (UTC)
Message
sure- originally merc.h looked like this after reading a post in these forums:
/* bit.c */
extern const struct flag_type area_flags[];
extern const struct flag_type sex_flags[];
extern const struct flag_type exit_flags[];
extern const struct flag_type door_resets[];
extern const struct flag_type room_flags[];
extern const struct flag_type sector_flags[];
extern const struct flag_type type_flags[];
extern const struct flag_type extra_flags[];
extern const struct flag_type wear_flags[];
extern const struct flag_type act_flags[];
extern const struct flag_type affect_flags[];
extern const struct flag_type apply_flags[];
extern const struct flag_type wear_loc_strings[];
extern const struct flag_type wear_loc_flags[];
extern const struct flag_type container_flags[];

/* ROM OLC: */

extern const struct flag_type form_flags[];
extern const struct flag_type part_flags[];
extern const struct flag_type ac_type[];
extern const struct flag_type size_flags[];
extern const struct flag_type off_flags[];
extern const struct flag_type imm_flags[];
extern const struct flag_type res_flags[];
extern const struct flag_type vuln_flags[];
extern const struct flag_type position_flags[];
extern const struct flag_type weapon_class[];
extern const struct flag_type weapon_type2[];
extern const struct flag_type furniture_flags[];
extern const struct flag_type apply_types[];


now it looks like this:
/* bit.c */
extern const struct flag_type * area_flags;
extern const struct flag_type * sex_flags;
extern const struct flag_type * exit_flags;
extern const struct flag_type * door_resets;
extern const struct flag_type * room_flags;
extern const struct flag_type * sector_flags;
extern const struct flag_type * type_flags;
extern const struct flag_type * extra_flags;
extern const struct flag_type * wear_flags;
extern const struct flag_type * act_flags;
extern const struct flag_type * affect_flags;
extern const struct flag_type * apply_flags;
extern const struct flag_type * wear_loc_strings;
extern const struct flag_type * wear_loc_flags;
extern const struct flag_type * container_flags;

/* ROM OLC: */

extern const struct flag_type * form_flags;
extern const struct flag_type * part_flags;
extern const struct flag_type * ac_type;
extern const struct flag_type * size_flags;
extern const struct flag_type * off_flags;
extern const struct flag_type * imm_flags;
extern const struct flag_type * res_flags;
extern const struct flag_type * vuln_flags;
extern const struct flag_type * position_flags;
extern const struct flag_type * weapon_class;
extern const struct flag_type * weapon_type2;
extern const struct flag_type * furniture_flags;
extern const struct flag_type * apply_types;
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #3 on Fri 12 Apr 2019 01:59 PM (UTC)
Message
Where are TRUE/FALSE/area_flags/sex_flags/etc declared? Is this happening inside of a function or outside of a function?

Can you please just link to the files so I can download them and look at everything?

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Cresus   (3 posts)  Bio
Date Reply #4 on Fri 12 Apr 2019 04:33 PM (UTC)
Message
yes, i downloaded it from here

http://mudmagic.com/codes/download/diku/merc/rom/rot/

rot2.0v5
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #5 on Sat 13 Apr 2019 01:14 AM (UTC)

Amended on Sat 13 Apr 2019 01:31 AM (UTC) by Fiendish

Message
So I downloaded the code from that link and I made the following changes to get it to compile on a mac. Some of these will be macOS-specific.

1. I created an obj directory inside of src.

2. (unix-based-specific) At the top of merc.h, I put
#define unix
because otherwise it doesn't pick up where the directories and stuff are because those ifdefs are old and busted.

3. (probably macOS-specific) I replaced all instances (in act_wiz.c and act_wiz2.c) of
#include <wait.h>
with
#include <sys/wait.h>


4. (probably macOS-specific) I replaced all instances (in save.c and whoweb.c) of
#include <malloc.h>
with
#include <sys/malloc.h>


5. In string.c I replaced getline with getLine, because getline conflicts with the function from stdio.h ( https://linux.die.net/man/3/getline )

6. In tables.h I moved all of the structs from the bottom of the file up to the top of the file.


That's it. Then it compiles using make. Whatever forum post you read is terrible and wrong, lol. Also you know that gcc 4 is like 15 years old, right? Obviously just my opinion, but you shouldn't hobble yourself with such an old version of gcc.

https://github.com/fiendish/aardwolfclientpackage
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,649 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.