This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
how to link "gettimeofday" with arm-elf-gcc?
- From: "Yusuke MATSUOKA" <yusuke at ee dot ucla dot edu>
- To: <ecos-discuss at sources dot redhat dot com>
- Date: Thu, 20 Nov 2003 13:47:20 -0800
- Subject: [ECOS] how to link "gettimeofday" with arm-elf-gcc?
Hi all,
I just wanna know how to link gettimeofday with arm-elf-gcc.
I'm trying to compile a simple program on Cygwin,
with arm-elf-gcc which is downloaded and installed via ecos-install.tcl
provided at ecos site.
I think I have built libraries for SA1110 successfuly, such as:
bash-2.05b$ pwd
/home/yusuke/SA1110_new/sa1110_install/lib
bash-2.05b$ ll
total 8974
drwxrwxrwx+ 2 yusuke None 0 Nov 19 15:17 ./
drwxrwxrwx+ 5 yusuke None 0 Oct 23 15:43 ../
-rw-rw-rw- 1 yusuke None 390748 Oct 23 15:32 extras.o
-rw-rw-rw- 1 yusuke None 402954 Oct 23 15:32 libextras.a
-rw-rw-rw- 1 yusuke None 8381312 Oct 23 15:32 libtarget.a
-rw-rw-rw- 1 yusuke None 2156 Oct 23 15:32 target.ld
-rw-rw-rw- 1 yusuke None 9236 Oct 23 15:32 vectors.o
However, when I compile as follows,
arm-elf-gcc.exe -g -I/home/yusuke/SA1110_new/sa1110_install/include \
-L/opt/ecos/gnutools/arm-elf/lib/gcc-lib/arm-elf/3.2.1 \
-L/home/yusuke/SA1110_new/sa1110_install/lib -Ttarget.ld \
-nostdlib hello.c
I got an error that linker cannot find "gettimeofday" as follows:
bash-2.05b$ make.csh
/ecos-c/DOCUME~1/yusuke/LOCALS~1/Temp/ccgyG7X0.o: In function `main':
/home/yusuke/SA1110_new/Hello/hello.c:12: undefined reference to
`gettimeofday'
collect2: ld returned 1 exit status
My code is quite simple:
#include<stdio.h>
#include <sys/time.h>
int main()
{
printf ("\n");
printf (" Hello World !!\n");
printf (" You are running this on the SA-1110\n");
printf ("\n");
struct timeval tv;
gettimeofday(&tv, NULL) ;
printf("%ld %ld\n", tv.tv_sec, tv.tv_usec);
return (0);
}
Can anybody help me, please?
Thanks,
Yusuke
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss