Too many initizalizers.

General

frogi16

1 month ago

EDIT: Got it. Defining it in a struct was the problem


No matter what I try I always get "too many initializers for 'const uint8_t [0] {aka const short unsigned int [0]}'" error when I create image buffer. Even this code from tutorial:

"const uint8_t myImgBuf[] = {
  8, 8, // width, heigth
  1, 0, // frames
  0, // frame loop
  0xFF, // transparent color
  1, // color mode

  0x07, 0x07, 0x07, 0x07,
  0x70, 0x70, 0x70, 0x70,
  0x07, 0x07, 0x07, 0x07,
  0x70, 0x70, 0x70, 0x70,
  0x07, 0x07, 0x07, 0x07,
  0x70, 0x70, 0x70, 0x70,
  0x07, 0x07, 0x07, 0x07,
  0x70, 0x70, 0x70, 0x70,
  };"

causes exactly the same error. What is the reason of this behavior?

Sorunome

NEW 1 month ago

EDIT: Got it. Defining it in a struct was the problem

Yeah, when defining an array in a struct you have to explicitly say how many elements it will have. Alternatively you can define a const uint8_t* pointer in the struct and then set the image data to that

frogi16

1 month ago

Exactly.


Personally I can't stand Arduino IDE, it's so primitive and doesn't help much.

frogi16

NEW 1 month ago

Sorunome Sorunome

Exactly.


Personally I can't stand Arduino IDE, it's so primitive and doesn't help much.

Please log in to join the discussion!

Log in