Solution for errors like "undefined reference to `timer_create'

main.c:(.text+0x5f10): undefined reference to `timer_create'
main.c:(.text+0x5f3d): undefined reference to `timer_settime'
main.c:(.text+0x5f75): undefined reference to `timer_delete'

modify the Makefile from:

$(CC) $(LDFLAGS) $(OBJECTS) -o $@

to:

$(CC) $(OBJECTS) -o $@ $(LDFLAGS)

because libraries have to go after the object files that depend on them on the compiler command line, not at the beginning.

Refer to:
https://stackoverflow.com/a/47613883/4947490

posted on 2021-10-19 14:11  tycoon3  阅读(630)  评论(0编辑  收藏  举报

导航