0

I want to declare a static multidimensional array in my class.

I have done the following:

header (myclass.h):

static int my_array[][][];

source file (myclass.cpp):

MyClass::my_array[3][4][5];

I have the problem of multidimensional array who must have bounds for all dimensions except the first...

Therefore I have tried to write this in the header file:

static int my_array[3][4][5];

And then nothing in the .cpp file.

But this time I got this error in the static functions that use my array: "undefined reference to MyClass::my_array"...

What is the way to solve it?

Cœur
  • 34,719
  • 24
  • 185
  • 251
fonfonx
  • 1,425
  • 20
  • 30

0 Answers0