Error: invalid application of 'sizeof' to incomplete type 'int []' when trying to compute the size of an array in a library
The reason is that in your sketch you import only the header file (which is good). However, there it is an array (int[]), not the initialized array.

For that you would need to include the cpp but that is bad practice (if even possible).

So instead, create a new (constant) variable, and assign it.

(more or less pseudo code, due to lack of a compiler):

Lib.h:

class Lib {
  public:
    static int arr[];
    static int arr_length;
};


Lib.cpp:

#include "Lib.h"

int Lib::arr[] = {0, 1, 2, 3};
int Lib::arr_length = sizeof(Lib::arr); 


Sketch:

#include &lt;Lib.h&gt;

void setup() {
  Lib::arr_length;
}


void loop() {}


See also the comment of LukasFun below. It is also possible to set the size of the array in the header file.

My advice though is keeping all assignments in the implementation (cpp) file. The header file is for defining items, the implementation file for initializing/assigning. But it works too, to initialize items in the header file.