I'm trying to compile a C project, and I am having some weird undefined reference errors.
A typical error message says:
lv_timer.c:(.text+0x94): undefined reference to `lv_lock'
When I look in the source file "lv_timer.c", I don't find any instances of "lv_lock"! Why?
What does the "(.text+0x094)" part mean? It seems to me that is is giving a hex offset with respect a ".text" tag. But when I look at the source file, this interpretation doesn't make sense.
Why am I obtaining this error? And any clues as to the meaning of the hex tag?
After suggestions, I am adding my code, although it doesn't compile - that's the issue!
I am working with the LVGL library. The only source file is just my main.c:
#include <stdlib.h>#include <unistd.h>#ifndef FALSE#define FALSE 0#endif#ifndef TRUE#define TRUE 1#endif#include <stdlib.h>#include <unistd.h>#include <string.h>#include "lvgl/lvgl.h"#include "lvgl/demos/lv_demos.h"static const wchar_t * title = L"LVGL port https://lvgl.io | https://docs.lvgl.io";int main(void){ //*Initialize LVGL*/ lv_init(); /*Initialize the HAL for LVGL*/ lv_display_t * display = lv_display_create(800, 400); /*Output prompt information to the console, you can also use printf() to print directly*/ LV_LOG_USER("LVGL initialization completed!"); //*Run the demo*// lv_demo_widgets(); char * demo_str[] = {"widgets"}; lv_demos_create(demo_str, strlen((char * )demo_str)); while(1) { /* Periodically call the lv_task handler. * It could be done in a timer interrupt or an OS task too.*/ lv_task_handler(); usleep(5000); /*Just to let the system breath*/ } return 0;}
Alongside the main.c file, I include an lv_config.h file (too long to reproduce here, but just contains #defines for parameters, no macros), and the [lvgl] folder with the library source files.
The makefile I am building by hand (I'm very inexperienced with makefiles, used as I am to IDEs):
objects = ../main.o ../lvgl/src/misc/lv_timer.o ../lvgl/src/lv_init.o ../lvgl/src/display/lv_display.o ../lvgl/src/misc/lv_log.o \ ../lvgl/demos/widgets/lv_demo_widgets.o ../lvgl/demos/lv_demos.o ../lvgl/src/misc/lv_ll.o ../lvgl/src/tick/lv_tick.otest : $(objects) gcc -o test $(objects)$(objects) : ../lv_conf.h.PHONY : clean clean : rm edit $(objects)
This is compiled in a Raspberry Pi.