Undefined reference to `ui_img_background2_png'

Error Message:
c:/users…/appdata/local/arduino15/packages/esp32/tools/esp-xs3/2302/bin/…/lib/gcc/xtensa-esp32s3-elf/12.2.0/…/…/…/…/xtensa-esp32s3-elf/bin/ld.exe: C:\Users.…\AppData\Local\Temp\arduino\sketches\D0461B9968DA153B2847E399409E989A\sketch\objs.a(squareline_button.ino.cpp.o):(.literal.ui_Screen1_screen_init+0x8): undefined reference to `ui_img_background2_png’

The image background2_png is in the assets folder in the Arduino project folder.

Can anyone help to resolve this error

I’m not using Arduino, but whenever I go to build a new export from SquareLine studio, I have to regenerate the build files that list which files need built in. Perhaps you must do something similar.

One test you can try: find the exported ‘C’ file that has ui_img_background2_png in it, and add #error to the top. If the #error prevents building, then the file is being compiled. If the project gets to the linker error you showed again, then the ‘C’ file containing that image is not being built, and the next step is to find out why.

Thanks for the input, this error happens for all images. Squareline is converting the images from png to .c and these are saved in an images folder. Normally .c images are in the lvgl assets folder. Copying across makes no difference. What surprises me that the error refers to the png files since squareline could find them to convert to .c. I will try your suggestion.

Another tip: Maybe it’s worth a try to toggle flat-export in Project Settings before exporting. It might be handled differently by Arduino whether the image-file C source is placed in images folder or put directly beside ui.c. (Though on my Linux machine with Arduino 1.8.19 both versions seem to build fine, having sketch folder set correctly in Arduino Preferences, so you might have the problem elsewhere.)