Quote:
Originally Posted by l_long_island
undefined reference to `ClassWithStaticArray::ArrayOfStruts'
|
That isn't the error message I would have expected for this problem. But it seems to fit.
Code:
class ClassWithStaticArray {
...
static IntegerStruct ArrayOfStruts [1];
...
};
That code only declares ArrayOfStruts. It doesn't define it.
Somewhere outside the class definition (and subject to the One Definition Rule) you need:
Code:
ClassWithStaticArray::IntegerStruct ClassWithStaticArray::ArrayOfStruts [1];
Edit: I didn't see dwhitney67's reply before posting. His comment about using two elements of a 1 element array is also correct.