This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

building something with nanotime


I'm trying to compile something with nanotime(9), which simply states
that I need to include sys/time.h - nothing about libraries to
include. Unfortunately when I compile, I get linker errors regarding
nanotime in both freebsd and windows/cygwin - so the problem is
probably my use of the nanotime library and not the platform:

FreeBSD
========================================
[sjss@elrond ~/dev/numbench]$ gcc numbench.c
/var/tmp//ccnZ4l7C.o(.text+0x155c): In function `loop_calibrate':
: undefined reference to `nanotime'
/var/tmp//ccnZ4l7C.o(.text+0x15b6): In function `loop_calibrate':
: undefined reference to `nanotime'
/var/tmp//ccnZ4l7C.o(.text+0x15ec): In function `iterbenchI':
: undefined reference to `nanotime'
/var/tmp//ccnZ4l7C.o(.text+0x165d): In function `iterbenchI':
: undefined reference to `nanotime'
/var/tmp//ccnZ4l7C.o(.text+0x1694): In function `iterbenchF':
: undefined reference to `nanotime'
/var/tmp//ccnZ4l7C.o(.text+0x1705): more undefined references to
`nanotime' follow
========================================

Cygwin:
========================================
$ gcc numbench.c -lc -lm
/cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x2b4):
undefined reference to `_srandomdev'
/cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x13ef):
undefined reference to `_nanotime'
/cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x1445):
undefined reference to `_nanotime'
/cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x1478):
undefined reference to `_nanotime'
/cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x14e5):
undefined reference to `_nanotime'
/cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x1518):
undefined reference to `_nanotime'
/cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x1585):
more undefined references to `_nanotime' follow
collect2: ld returned 1 exit status
========================================


I tried adding a few libraries that might be useful:  -lc -lm -lmd
-lpthread, but with no luck. I figured I'd try to find what library it
is in, but couldn't (strings /lib/* | grep nano; string /usr/lib/* |
grep nano). I could only find nanosleep, and a few other non-nanotime
references.

My includes (shouldn't be the problem):
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <string.h>


How do I solve this issue?

Thanks,
-Jim Stapleton


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]