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
  • 37,241
  • 25
  • 195
  • 267
fonfonx
  • 1,475
  • 21
  • 30

0 Answers0