2 msggcc 64-bit (assembly) information
4 msgAssembly symbol generation
1 msgAdding another language after configure .. make...
1 msgremoving a statement from SSA representation
5 msgFine tuning gcc build to machine specific prope...
3 msgSPARC64 64-bit tool chain
1 msgRFC: GCC should warn when evaluating a pointer ...
6 msgloading multiple C++ runtimes but not mixing ABIs?
1 msgRe: Anyone knows how to

building something with nanotime
\ Jim Stapleton (31 Aug 2007)
. \ Brian Dessent (31 Aug 2007)
. . \ Jim Stapleton (31 Aug 2007)
. \ Brian Dessent (31 Aug 2007)

2 msgProblem building stage 1 ARM C compiler
2 msgAnyone knows how to 'undergrade' gcc ?? -- non ...
1 msgglitchy dmg installer
1 msg__CLASS__
1 msgSpecifying the location/behavior of the stack?
1 msgcross compiler MinGW->PowerPC
1 msgproblems building gcc3.2 on suse 10.1
7 msgAverage number of instructions per line of kern...
5 msgHow to remove the option -Qy to as
1 msgLinker question
Subject:building something with nanotime
Group:Gcc-help
From:Jim Stapleton
Date:31 Aug 2007


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


© 2004-2008 readlist.com