I\'m trying to compile an object code with a reference to one lib. This is the code of libexample.c:
#include \"libexample.h\"
#include
#include
The man timer_create command explains you:
NAME
timer_create - create a POSIX per-process timer
SYNOPSIS
#include
#include
int timer_create(clockid_t clockid, struct sigevent *sevp,
timer_t *timerid);
Link with -lrt.
So you should, as documentation says, link with -lrt.
So use
gcc libexample.c -fPIC -shared -o libexample.so -lrt
to produce your libexample.so.
As undur_gongor commented, you need to put the libraries in good order after all the rest (the usual order for gcc arguments is source files, object files, libraries in dependency order) in gcc or ld commands (and that is documented in ld documentation, and in gcc ones). So -lrt should go last.
And learn to read man pages.