Okay, strange question time!
I'm refactoring some old C++ code that declares a bunch of arrays like so:
static SomeStruct SomeStructArray[] = {
{1, 2, 3},
{4, 5, 6},
{NULL, 0, 0}
}
And so forth. These are scattered about in the source files, and are used right where they're declared.
However, I would like to move them into a single source file (mostly because I've come up with a way of auto-generating them). And, of course, I naively try to make a header for them:
static SomeStruct SomeStructArray[];
Actually, even I know that's wrong, but here's the compiler error anyway:
error C2133: 'SomeStructArray' : unknown size arrays.h
error C2086: 'SomeStruct SomeStructArray[]' : redefinition arrays.cpp
So, I guess, what's the right way to do this?