26 Mar, 2009, Openfusili wrote in the 1st comment:
Votes: 0
Here are the errors i'm getting. (there are alot more, this is just 1 chunk.)

tables.c:1136: warning: braces around scalar initializer
tables.c:1136: warning: (near initialization for `extra2_flags')
tables.c:1136: warning: excess elements in scalar initializer
tables.c:1136: warning: (near initialization for `extra2_flags')
tables.c:1136: warning: excess elements in scalar initializer
tables.c:1136: warning: (near initialization for `extra2_flags')
tables.c:1136: warning: excess elements in scalar initializer
tables.c:1136: warning: (near initialization for `extra2_flags')


This is the code in tables.c

const struct flag_type * extra2_flags =
{
{ "graft", ITEM2_GRAFT, TRUE },
{ "ethereal", ITEM2_ETHEREAL, TRUE },
{ "noscan", ITEM2_NOSCAN, TRUE },
{ "relic", ITEM2_RELIC, TRUE },
{ "nodonate", ITEM2_NODONATE, TRUE },
{ "norestring", ITEM2_NORESTRING, TRUE },
{ NULL, 0, 0}
};


Any help would be greatly appriciated. I've never run into this problem.
26 Mar, 2009, Igabod wrote in the 2nd comment:
Votes: 0
what's the first error message in the long line of messages? and point out which line of the code you've posted is the line the first warning complains about.

Also, from now on you should use the
tags (minus the spaces) so that your code retains it's formatting and we can see things easier. Don't forget the
tag at the end of your code.

[edit to add] looks like you're missing a comma after the } right before the closing };
26 Mar, 2009, Openfusili wrote in the 3rd comment:
Votes: 0
first error in the long list.
tables.c:44: warning: braces around scalar initializer


line 1136
{ NULL,          0,                  0}
26 Mar, 2009, Igabod wrote in the 4th comment:
Votes: 0
Upon looking at a rom codebase I was wrong, there is no missing comma on that line, but it is the one that's being complained about. The only difference I can see between the stock extra_flags struct is the first line of the struct. you have a * there and no []. I'm not really an expert with these things, but here's what the first line of the stock extra_flags stuct looks like.

const struct flag_type extra_flags[] = {

I know that the []'s are braces so that seems to be the problem to my untrained eyes. Try changing your first line to this:
const struct flag_type extra2_flags[] =
26 Mar, 2009, Openfusili wrote in the 5th comment:
Votes: 0
Well, it compiles, but it throws these errors now.
*snippit*
tables.h:30: warning: array type has incomplete element type
tables.h:31: warning: array type has incomplete element type
tables.h:32: warning: array type has incomplete element type
tables.h:35: warning: array type has incomplete element type
tables.h:36: warning: array type has incomplete element type
tables.h:37: warning: array type has incomplete element type


The code its pointing too is…

extern const struct position_type position_table[];
extern const struct sex_type sex_table[];
extern const struct size_type size_table[];

/* flag tables */
extern const struct flag_type act_flags[];
extern const struct flag_type plr_flags[];
extern const struct flag_type affect_flags[];
26 Mar, 2009, Igabod wrote in the 6th comment:
Votes: 0
do you have extern const struct flag_type extra2_flags[]; in there somewhere?
26 Mar, 2009, Openfusili wrote in the 7th comment:
Votes: 0
extern const struct flag_type extra2_flags[];


same error for that as the others.
26 Mar, 2009, Igabod wrote in the 8th comment:
Votes: 0
hmm I think this is going to require someone with a little bit more skill than myself to solve, but let me try everything I can think of. Did you give the first warning message that popped up this time as well? if not, then you should know that the first one is the most important one, don't just snip out a chunk of other messages just cause they're similar to the others. If tables.h:30 is the first message then look at it and see what's different about it from what's above it. If it's not the first one then post that bit of code. I'm sorry I'm not more help than this, but I'll try everything I can think of to help you.
26 Mar, 2009, Openfusili wrote in the 9th comment:
Votes: 0
In file included from act_comm.c:41:
tables.h:30: warning: array type has incomplete element type

thats the very first thing that comes up when i start compiling.


line 30 is the first line of code in tables.h besides the includes.
26 Mar, 2009, Igabod wrote in the 10th comment:
Votes: 0
are you sure position_table is the first line of code? My stock rom24b6OLC has clan_table before that. not that that really matters too much since that's not the line the compiler is complaining about, but maybe you're missing a ; at the end of the line with clan_table. What you posted is identical to what I see in stock though so it doesn't appear that there is a problem with that bit of code. If none of this is helpful then I'm out of ideas for the moment.

[edit to add] and why do you have includes in tables.h? stock starts out with the header giving credit to diku and rom etc. then I've got this:

/* game tables */
extern const struct clan_type clan_table[MAX_CLAN];
extern const struct position_type position_table[];
extern const struct sex_type sex_table[];
extern const struct size_type size_table[];

/* flag tables */
extern const struct flag_type act_flags[];
extern const struct flag_type plr_flags[];
extern const struct flag_type affect_flags[];
extern const struct flag_type off_flags[];
extern const struct flag_type imm_flags[];
extern const struct flag_type form_flags[];
extern const struct flag_type part_flags[];
extern const struct flag_type comm_flags[];
extern const struct flag_type extra_flags[];
extern const struct flag_type wear_flags[];
extern const struct flag_type weapon_flags[];
extern const struct flag_type container_flags[];
extern const struct flag_type portal_flags[];
extern const struct flag_type room_flags[];
extern const struct flag_type exit_flags[];
26 Mar, 2009, Openfusili wrote in the 11th comment:
Votes: 0
*       Russ Taylor (rtaylor@hypercube.org)                                *
* Gabrielle Taylor (gtaylor@hypercube.org) *
* Brian Moore (zump@rom.org) *
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
***************************************************************************/


/* game tables */
extern const struct position_type position_table[];
extern const struct sex_type sex_table[];
extern const struct size_type size_table[];


extern const struct position_type position_table[]; is line 30.



as for the includes, i was mistaken, a bit tired. sorry lol
26 Mar, 2009, Igabod wrote in the 12th comment:
Votes: 0
hmm ok this is beyond my level of skill in fixing, I'm sure someone with more skill will answer your question and make me look like an idiot. Sorry I couldn't help more.
26 Mar, 2009, ghasatta wrote in the 13th comment:
Votes: 0
Quote
tables.h:30: warning: array type has incomplete element type


The compiler is giving you a warning, not an error. It won't, per se, cause your build to break. If the compile is failing, it's because of something in addition to these. Please post your entire compile command and the full output from gcc. I want to see what switches you have set when you invoke gcc.
26 Mar, 2009, Igabod wrote in the 14th comment:
Votes: 0
he said it's compiling, he got past the error and now it's just giving him those warnings.

Why does everybody say "Oh don't worry, it's just a warning not an error"? My code has absolutely no warnings or errors when I compile and I think it makes the errors easier to see when I do mess something up. In my book, a warning is just as bad as an error because it means I didn't do something the proper way. Besides, any time gcc upgrades, you face the possibility of those warnings becoming errors, so why not fix it now so you don't have to worry about it later?
26 Mar, 2009, tphegley wrote in the 15th comment:
Votes: 0
Igabod said:
he said it's compiling, he got past the error and now it's just giving him those warnings.

Why does everybody say "Oh don't worry, it's just a warning not an error"? My code has absolutely no warnings or errors when I compile and I think it makes the errors easier to see when I do mess something up. In my book, a warning is just as bad as an error because it means I didn't do something the proper way. Besides, any time gcc upgrades, you face the possibility of those warnings becoming errors, so why not fix it now so you don't have to worry about it later?


He's not saying 'oh, it's a warning, you don't need to fix it', he's just clarifying that 'it's a warning not an error' because TC keeps calling them errors.
26 Mar, 2009, elanthis wrote in the 16th comment:
Votes: 0
A warning CAN cause your build to break if you have -Werror on. Furthermore, warnings are there for a reason. Fix them.

The position_type thing simply means that you haven't included any headers that defines what position_type is, so the compiler has no clue what that array actually is, because the size of position_type (which requires the full definition there-of) is required to calculate the actual size and layout of the array. Figure out which header has that and include it before defining the table.
26 Mar, 2009, Guest wrote in the 17th comment:
Votes: 0
26 Mar, 2009, Mister wrote in the 18th comment:
Votes: 0
The compiler needs the structure definition before the variable that uses it, and if you declare an array, declare it as an array, not a pointer. Example:
struct foo {
int a;
int b;
};

const struct foo bar[] = {
{ 1,2 },
{ 1,2 }
};
26 Mar, 2009, Openfusili wrote in the 19th comment:
Votes: 0
Thanks Samson, that link fixed it perfectly. Now only a few thousand more warnings to go. :D
26 Mar, 2009, Fizban wrote in the 20th comment:
Votes: 0
Igabod said:
I know that the []'s are braces so that seems to be the problem to my untrained eyes.


For what it's worth [] aren't braces, they're brackets; {} are braces.
0.0/31