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

原文地址:https://www.cnblogs.com/dream397/p/15424495.html