[Prev][Next][Index][Thread]
__USE_GNU was: undefined reference to `TIMEVAL_TO_TIMESPEC'
At 14:47 +0100 11/18/01, Geert Stappers wrote:
>Hello,
>
>Which file should I install to avoid
>"undefined reference to `TIMEVAL_TO_TIMESPEC'"
>messages?
>
>
>make[1]: Entering directory `/usr/src/oskit-20010214-tar/examples/unix'
>gcc -O -g -o fsread \
> -e _start ../../lib/unix/crt1.o ../../lib/unix/crti.o \
> ../../lib/unix_support.o \
> fsread.o \
> -nostdlib -L../../lib \
> -Wl,--start-group -loskit_startup -loskit_clientos \
> -loskit_unix \
> -loskit_lmm \
> -loskit_linux_dev -loskit_fsread \
> -loskit_unix \
> -loskit_c \
> -loskit_dev \
> -loskit_c -loskit_com -loskit_c \
> -lgcc -Wl,--end-group \
> ../../lib/unix/crtn.o
>../../lib/unix_support.o: In function `oskit_rtc_get':
>/usr/src/oskit-20010214/unix/rtclock.c:45: undefined reference to
>`TIMEVAL_TO_TIMESPEC'
>../../lib/unix_support.o: In function `oskit_rtc_set':
>/usr/src/oskit-20010214/unix/rtclock.c:61: undefined reference to
>`TIMESPEC_TO_TIMEVAL'
>collect2: ld returned 1 exit status
>make[1]: *** [fsread] Error 1
>make[1]: Leaving directory `/usr/src/oskit-20010214-tar/examples/unix'
>make: *** [examples/unix/all.MAKE] Error 2
>stappers@mir:/usr/src/oskit-20010214-tar
>$
>
Meanwhile I known that it can be defined in /usr/include/sys/time.h
But there is a #ifdef
#ifdef __USE_GNU
/* Macros for converting between `struct timeval' and `struct timespec'. */
# define TIMEVAL_TO_TIMESPEC(tv, ts) { \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
}
# define TIMESPEC_TO_TIMEVAL(tv, ts) { \
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
}
#endif
How can I define it.
"gcc -D__USE_GNU rtclock.c" failed.
A line "#define __USE_GNU" in rtclock.c also failed.
Any suggestions are welcome.
Geert
Follow-Ups:
References: