I have to create a static library (this is not the option to create a dynamic one), and I have a function that is stable library Something like this:
somelib.h:
# that uses timer_create
from time.h
Include & lt; Time.h> Int do_something (zero);
somelib.c:
int do_something (zero) {timer_t timer; Straight sigevent sevp; Sevp.sigev_notify = SIGEV_SIGNAL; Sevp.sigev_signo = SIGRTMIN; Sevp.sigev_value.sival_ptr = NULL; Int rate = timer_credit (CLOCK_MONOTONIC, & amp; sewep, and timer); Timer_delete (clock); Return 0; }
The code is actually null and it is necessary to link against the libel to clarify my progelom, which is as follows:
When I compile the sombab I am C:
GCC-CoAmailib.O Amelib CR-LRT
and create a static library:
AR RCS somelib.a somelib.o
The following error is found when linking:
gcc -o someexec someexec.c -lrt ./somelib.a
returns:
somelib.c :( text + 0x30): Undefined context for 'timer_create' somelib.c :( .text + 0x44): Undefined reference to `timer_destroy '
This is a minimal example of my problem. I'm not sure if this can be fixed at all, because I understand that static liability will have to know the place of the Libre at the time of its creation and since it is dynamic, it is a static library version yet still Libraries do not use much time, so I want to know that there is no way to do something like that.
Compiler Edition: GCC 4.8.1 No other flag set.
GCC-CoOmail Somelib.c -lrt
This is the only compilation, -lrt
is irrelevant here.
GCC-O Something XACXAk-LRT / SOMBBAA
Orders to order / library cases. Try ending
-lrt
, then it should work.
No comments:
Post a Comment