Quote:
Adding forward declaration does not help:
file A.h
struct B;
extern struct B a[3];
...
extern B *a; // This is ok
|
The problem is that the type of the structure is not known and therefore a forward declaration of the type will not work unless the instance is a reference, in C a pointer and in C++ also a reference.
"The above code is legal, but this change is unexceptable." If you can not include the definition of the type in the header the normal path to take is to use the pimpl idiom or a reference. The fault maybe from your design if this is your code, I do not know it is but will assume so and assume C++ as you are using new.
Why does your design require a global instance of an array?
Why an array and not a vector?
Why not local or in a namespace other than global?
Why does the definition need to be made available to header which can not use it or operate on the type?