[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] problems using time.h on freebsd 4.10
From: |
gouy yann |
Subject: |
RE: [avr-gcc-list] problems using time.h on freebsd 4.10 |
Date: |
Thu, 1 Sep 2005 10:42:41 +0200 (CEST) |
Hi,
it seems you're using the BSD header not the AVR specfic header.
try something like -I/usr/local/acr/include.
the undefined reference to time is due to a missing library or object but I
wasn't aware time related functions were available in avr-libc.
regards.
Yann
--- Timothy Smith <address@hidden> a écrit :
> my code example
>
> #include <inttypes.h>
> #include <avr/io.h>
> #include <time.h>
>
> int main(void)
> {
> DDRA = (1 << 1);
> time_t blink = time(NULL)+2;
> while (1) {
> while (blink < time(NULL)) {
> PORTA = 1;
> };
> blink = time(NULL)+2;
> while (blink < time(NULL)) {
> PORTA = 0;
> };
> blink = time(NULL)+2;
> };
> }
>
> # avr-gcc -I/usr/include -g -Os -mmcu=atmega32 led.c
> /var/tmp//ccJbKrxY.o(.text+0x16): In function `main':
> /home/timothy/AVR/led.c:11: undefined reference to `time'
> /var/tmp//ccJbKrxY.o(.text+0x2c):/home/timothy/AVR/led.c:13: undefined
> reference to `time'
> /var/tmp//ccJbKrxY.o(.text+0x4c):/home/timothy/AVR/led.c:15: undefined
> reference to `time'
> /var/tmp//ccJbKrxY.o(.text+0x62):/home/timothy/AVR/led.c:17: undefined
> reference to `time'
>
> if i don't use the -I flag i get
>
> avr-gcc -g -Os -mmcu=atmega32 led.c
> led.c:3:18: time.h: No such file or directory
> led.c: In function `main':
> led.c:8: error: `time_t' undeclared (first use in this function)
> led.c:8: error: (Each undeclared identifier is reported only once
> led.c:8: error: for each function it appears in.)
> led.c:8: error: parse error before "blink"
> led.c:10: error: `blink' undeclared (first use in this function)
> led.c:10: error: `NULL' undeclared (first use in this function)
>
> however...
> ls -l /usr/include/time.h
> -r--r--r-- 1 root wheel 5366 May 26 2004 /usr/include/time.h
>
> so time.h is clearly there.
>
> so. obviously there is something funky about time.h and avr-gcc under
> fbsd 4.10. where are my details
> # avr-gcc -v
> Reading specs from /usr/local/lib/gcc/avr/3.4.4/specs
> Configured with: ./configure --target=avr --disable-nls
> --prefix=/usr/local i386-portbld-freebsd4.10
> Thread model: single
> gcc version 3.4.4
>
>
>
>
> _______________________________________________
> AVR-GCC-list mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
>
___________________________________________________________________________
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez cette version sur http://fr.messenger.yahoo.com