Static const int myArray[3][3] = {{1,2,3},{1,2,3},{1,2,3}}; can't compile

Hello everyone,

I am trying to initialise a static array of integers as the array is large and will never change.

With the below code I get the error:

a static data member with an in-class initializer must have non-volatile const integral type or be specified as ‘inline’

 static const int myArray[3][3] = {{1,2,3},{1,2,3},{1,2,3}};

Can anyone help?
Cheers!

In the header:

static const int myArray[3][3];

In the source file:

const int MYCLASS::myArray[3][3] = { {1,2,3},{1,2,3},{1,2,3} };

Thank you! I ended up with a work-around and made it non static and non const but I will revert back to this :slight_smile: