07 Jul, 2011, thalor wrote in the 1st comment:
Votes: 0
Hey had a rom based mud that compiled just fine under Redhat 7.1

Decided to move to Ubuntu 11.04 and now I get an error I cannot figure out.

data_h.c:92:7: error: assignment of read-only location 'skill_table[(int)count]'

merc.h contains

extern  const   struct  skill_type      skill_table     [MAX_SKILL];

while the data_h.c contains:

if ( IS_SET(skill_table[count].flags, GROUP_CHANGED) )
REMOVE_BIT(skill_table[count].flags, GROUP_CHANGED);

With line 92 being the REMOVE_BIT line.

I'm a little absent minded on why this error is happening. can someone explain why?

07 Jul, 2011, RoFAdmin wrote in the 2nd comment:
Votes: 0
You have it defined as a constant.

You can not modify a constant. Or more appropriately you are not supposed to, and not supposed to be able to.
All i can assume is that you were compiling with an older version of gcc when using redhat and ubuntu contains a newer version, and thus contains new default rules enabled when compiling.
07 Jul, 2011, thalor wrote in the 3rd comment:
Votes: 0
Yep that was it….I changed the merc.h to not be const and it flew past the errors….however,

Now I am getting the same type of error in db.c

error: assignment of read-only location '*skill_table[sn].pgsn'

from db.c

* Assign gsn's for skills which have them.
int sn;

for ( sn = 0; sn < MAX_SKILL; sn++ )
if ( skill_table[sn].pgsn != NULL )
*skill_table[sn].pgsn = sn;

and the merc.h now reads:
extern    struct  skill_type      skill_table     [MAX_SKILL];

Any ideas on that one?


I've tried removing the * in front of skill_table, but that only causes more problems.
It compiles but doesn't assign the gsn's
07 Jul, 2011, David Haley wrote in the 4th comment:
Votes: 0
Chances are that pgsn is const in the skill_type structure.
07 Jul, 2011, thalor wrote in the 5th comment:
Votes: 0
That looks to have fixed it.

pgsn was indeed set to const.