# Undefined reference to \`ui\_img\_background2\_png'

**URL:** <http://forum.squareline.io/t/undefined-reference-to-ui-img-background2-png/3570>\
**Category:** My projects\
**Tags:** lvgl\
**Created:** [July 17, 2024, 4:17pm UTC](http://forum.squareline.io/t/undefined-reference-to-ui-img-background2-png/3570 "2024-07-17T16:17:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjgc](http://forum.squareline.io/letter_avatar_proxy/v4/letter/s/919ad9/32.png) [@sjgc](http://forum.squareline.io/u/sjgc)\
**Post date:** [July 17, 2024, 4:17pm UTC](http://forum.squareline.io/t/undefined-reference-to-ui-img-background2-png/3570/1 "2024-07-17T16:17:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Richard](http://forum.squareline.io/user_avatar/forum.squareline.io/richard/32/1129_2.png) [@Richard](http://forum.squareline.io/u/Richard)\
**Post date:** [July 17, 2024, 6:16pm UTC](http://forum.squareline.io/t/undefined-reference-to-ui-img-background2-png/3570/2 "2024-07-17T18:16:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sjgc](http://forum.squareline.io/letter_avatar_proxy/v4/letter/s/919ad9/32.png) [@sjgc](http://forum.squareline.io/u/sjgc)\
**Post date:** [July 17, 2024, 6:51pm UTC](http://forum.squareline.io/t/undefined-reference-to-ui-img-background2-png/3570/3 "2024-07-17T18:51:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Hermit](http://forum.squareline.io/user_avatar/forum.squareline.io/hermit/32/971_2.png) [@Hermit](http://forum.squareline.io/u/Hermit)\
**Post date:** [July 19, 2024, 9:08am UTC](http://forum.squareline.io/t/undefined-reference-to-ui-img-background2-png/3570/4 "2024-07-19T09:08:32Z")

</div>

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.)
