Jum schrieb:
Hi,
I wrote a c program to read arrays from a txt file and then do a insertion
sort. It runs OK while compiling in gcc. However, I need to convert it to
elf file by using 'avr-gcc -o filename.elf -mmcu=atmega128 filename.c'
command. And then things happened as following:
jum@ubuntu-VirtualBox:~$ avr-gcc -o fget.elf -mmcu=atmega128 fget.c
fget.c: In function 'convert':
fget.c:29: warning: assignment makes pointer from integer without a cast
fget.c:36: warning: assignment makes pointer from integer without a cast
fget.c: In function 'main':
fget.c:73: warning: initialization makes pointer from integer without a cast
/tmp/ccWExtSv.o: In function `convert':
fget.c:(.text+0x124): undefined reference to `strtok'
fget.c:(.text+0x170): undefined reference to `strtok'
/tmp/ccWExtSv.o: In function `main':
fget.c:(.text+0x31c): undefined reference to `fopen'
strtok is implemented in libc. Thus you need a libc to link against.
Common libc to cooperate with avr-tools are avr-libc or newlib.
For avr-libc, see
http://nongnu.org/avr-libc/user-manual/group__avr__string.html
Best Regards
Jum
Johann
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list