Using images in LVGL, getting "error: expected primary-expression before '.' token"

I’m trying to use images in LVGL. I’ve converted it via the online converter just as the docu says.
I’ve tried this once before but moved on, but it’s time to make it work.

It gives error for the dots at the bottom. I have added include of Arduino.h as well. This is the error I get:

In file included from src\main.cpp:7:0:
src\images/SoS_Skull.c:735:3: error: expected primary-expression before '.' token
   .header.always_zero = 0,
   ^
src\images/SoS_Skull.c:736:3: error: expected primary-expression before '.' token
   .header.w = 191,
   ^
src\images/SoS_Skull.c:737:3: error: expected primary-expression before '.' token
   .header.h = 237,
   ^
src\images/SoS_Skull.c:739:3: error: expected primary-expression before '.' token
   .header.cf = LV_IMG_CF_RAW_ALPHA,
   ^

Here is the code:

const lv_img_dsc_t SoS_Skull = {
  .header.always_zero = 0,
  .header.w = 191,
  .header.h = 237,
  .data_size = 11505,
  .header.cf = LV_IMG_CF_RAW_ALPHA,
  .data = SoS_Skull_map,
};```

I had the same trouble. i have changed like this :

const lv_img_dsc_t wps = {
{LV_IMG_CF_TRUE_COLOR_ALPHA,
0,
2,
32,
32},
1024 * LV_IMG_PX_SIZE_ALPHA_BYTE,
wps_map
};

you have to change with your own definitions

1 Like

Working nicely, thank you!!

1 Like