Compile Error in Application (trying to display an Image)

I am trying to get a simple application to run using an ESP32 and ILI9488 TFT to display an image that was converted utilizing the Image Conversion Tool

I have added the c file to my project, when I try to compile the code I get the following error:
expected primary-expression before ‘.’ token at the line .header.cf = LV_IMG_CF_INDEXED_8BIT,

const lv_img_dsc_t heading_indicator = {
  .header.always_zero = 0,
  .header.w = 190,
  .header.h = 190,
  .data_size = 37124,
  .header.cf = LV_IMG_CF_INDEXED_8BIT,
  .data = heading_indicator_map,
};

Any suggestions?

Or is there some sample code somewhere that can run a simple image example utilizing the image conversion tool?

Thank…

Usually this error occurs when your compiler is treating the file as C++, which doesn’t support the dot notation for initializing structs.

You can try reordering the .data_size and .header.cf lines, see if there’s a way to make your compiler accept this syntax, or try this workaround which removes the dot notation:

const lv_img_dsc_t heading_indicator = {
  { LV_IMG_CF_INDEXED_8BIT, 0, 2, 190, 190 },
  37124,
  heading_indicator_map
};

In case you’re wondering how to do this for another image, the struct definitions can be found in this header file.

The code format change as you suggested worked!! THANKS…

I did notice the number 2 in the parameter list, saw in the header it is needed…

Thanks again!