It means MAX_QUOTES is defined as one more than the number of entries you have in the table.
30 Jan, 2009, Rojan QDel wrote in the 3rd comment:
Votes: 0
When I lower the number by one, I get this: Compiling o/const.o…const.c:551: error: too many initializers for `const quote_type[38]' const.c:551: warning: missing initializer for member `quote_type::by'
Can you post the whole table, and the MAX_QUOTES define so I can see them?
30 Jan, 2009, David Haley wrote in the 5th comment:
Votes: 0
Post the definition of the quote_type structure – it's telling you that you're not initializing all members of the structure.
30 Jan, 2009, Rojan QDel wrote in the 6th comment:
Votes: 0
struct quote_type { char * text; char * by; };
30 Jan, 2009, David Haley wrote in the 7th comment:
Votes: 0
Oh, never mind then. Well, do what Kayle said and show us the whole table and the value of MAX_QUOTES.
30 Jan, 2009, Rojan QDel wrote in the 8th comment:
Votes: 0
const struct quote_type quote_table [MAX_QUOTES] = { { "All battles are fought at the junction of two or more map sheets.", "Murphy's Laws of Combat"}, { "If the enemy is in range, so are you.", "Murphy's Laws of Combat" }, { "Incoming fire has the right of way.", "Murphy's Laws of Combat" }, { "Dont look conspicuous… It draws fire.", "Murphy's Laws of Combat" }, { "There is always a way.\n\r The easy way is always mined.", "Murphy's Laws of Combat" }, { "Try to look unimportant, they may be low on ammo.", "Murphy's Laws of Combat" }, { "Teamwork is essential… It gives them someone else to shoot at.", "Murphy's Laws of Combat" }, { "The tank is a monument to the inaccuracy of indirect fire.", "Murphy's Laws of Combat" }, { "Never reinforce failure… failure reinforces itself.", "Murphy's Laws of Combat" }, { "Odd objects attact fire. You are odd.", "Murphy's Laws of Combat" }, { "If they are shooting at you, it is a high-intensity conflict.", "Murphy's Laws of Combat" }, { "War is the unfolding of miscalculations.", "Murphy's Laws of Combat" }, { "A sucking chest wound is natures way of saying 'Slow down'", "Murphy's Laws of Combat" }, { "Never draw fire…. It irritates everyone around you.", "Murphy's Laws of Combat" }, { "Friendly fire… Is'nt.", "Murphy's Laws of Combat" }, { "No matter which way you have to march… Its always uphill.", "Murphy's Laws of Combat" }, { "For every action, there is a equal and opposite criticism.", "Murphy's Laws of Combat" }, { "If its stupid but it works… Then its not stupid.", "Murphy's Laws of Combat" }, { "When in doubt…. Empty the magazine.", "Murphy's Laws of Combat" }, { "If it flies… It dies…", "Murphy's Laws of Combat" }, { "(OOC) *Zakharov Obi-Wan's LOTJ Last Words: Strike me down and I'll use the points to make an alt more powerful than you can possibly imagine." }, { "Tracers work BOTH WAYS.", "Murphy's Laws of Combat" }, { "Military intelligence is a contradiction of terms.", "Murphy's Laws of Combat" }, { "Priorities are made by officers, not by God. There IS a diffrenence.", "Murphy's Laws of Combat" }, { "If you need a officer in a hurry… Take a nap.", "Murphy's Laws of Combat" }, { "The weapon that usally jams when you need it most is yours.", "Murphy's Laws of Combat" }, { "Peace is our profession… Mass murder is just a hobby.", "Murphy's Laws of Combat" }, { "Fighting for peace is like screwing for virginity.", "Murphy's Laws of Combat" }, { "When you lose contact with the enemy, look behind you.", "Murphy's Laws of Combat" }, { "The most dangerous thing in a combat zone is an officer with a map.", "Murphy's Laws of Combat" }, { "There is nothing more satisfying then having someone take a shot at you. And miss.", "Murphy's Laws of Combat" }, { "Theres too much blood in my caffine system!", "Unknown" }, { "We have enough youth, how about a fountain of smart?", "Unknown" }, { "Yeah, Right… Like their going to give beggars weapons! Bwhahahaha!", "Famous last words of Imperial Spies" }, { "Always walk at the end of the line. Your less likely to get hit by the claymores.", "Great words of Advice" }, { "You have two choices: Kill, or be Killed. Or maybe a third I have'nt thought of…", "Unknown" }, { "Hey, This Doormat kind of looks like a mine! Wait-a-minute…", "Famous last words of Imperial Spies" }, { "Can you say terrorism? I though you could!", "Mister Rodgers, Black Sun Inductee" }, { "The complexity of a weapon is inversely proportional to the IQ of its operator.", "Murphy's Laws of Combat" } };
#define MAX_QUOTES 39
30 Jan, 2009, David Haley wrote in the 9th comment:
Votes: 0
{ "(OOC) *Zakharov Obi-Wan's LOTJ Last Words: Strike me down and I'll use the points to make an alt more powerful than you can possibly imagine." },
there's your culprit (at least one of them…)
This is why it's useful to post the actual code, not try to simplify it into something that doesn't exhibit the problem behavior. I suspect that the example you gave above would actually compile! If you're going to give a minimal example, make sure it actually exhibits the problem…
30 Jan, 2009, Rojan QDel wrote in the 10th comment:
Votes: 0
Our current code does compile. But that fixed the warning, thanks!
30 Jan, 2009, David Haley wrote in the 11th comment:
Votes: 0
Sorry, by "compile", I meant "compile cleanly" (where "cleanly" means without the problem in question). But good to hear that it's gone now!
const.c:551: warning: missing initializer for member `quote_type::by'
It's in a quotes table that we have, structured like so:
const struct quote_type quote_table [MAX_QUOTES] =
{
{ "Quote", "Author" },
{ "Quote 2", "Author 2" },
{ "Quote 3", "Author 3" }
}; //Line 551
I've definitely seen..and fixed this warning before on another codebase, though I can't remember how. Could anyone offer some advice?