Teensy++ v.2的blinky.zip,gcc-部分中的说明。Makefile和blinky.c在压缩包中。我在开始时通过定义F_CPU修改了blinky.c,因为请不要使用Makefile,见下文。那么,为什么我得到了错误,我如何才能为at90usb1286芯片编译C文件?
$ avr-gcc -mmcu=atmega88 blinky.c
In file included from blinky.c:28:
/usr/local/lib/gcc/avr/4.2.2/../../../../avr/include/util/delay.h:90:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed"
/tmp//ccB66ecl.o: In function `main':
blinky.c:(.text+0x3e): undefined reference to `usb_init'
/tmp//ccB66ecl.o: In function `morse_character':
blinky.c:(.text+0x24c): undefined reference to `print_P'
blinky.c:(.text+0x36e): undefined reference to `print_P'
blinky.c:(.text+0x378): undefined reference to `usb_debug_putchar'
blinky.c:(.text+0x37e): undefined reference to `print_P'
blinky.c:(.text+0x386): undefined reference to `print_P'
blinky.c:(.text+0x390): undefined reference to `usb_debug_putchar'
blinky.c:(.text+0x394): undefined reference to `usb_debug_putchar'
blinky.c:(.text+0x416): undefined reference to `print_P'
blinky.c:(.text+0x4fa): undefined reference to `print_P'
blinky.c:(.text+0x6f8): undefined reference to `print_P'
/tmp//ccB66ecl.o: In function `morse_P':
blinky.c:(.text+0x834): undefined reference to `print_P'
发布于 2010-06-05 07:34:13
这些都是链接错误。您只能执行编译(请注意,我添加了-c
标志):
avr-gcc -c -mmcu=atmega88 blinky.c
然后,您必须将其与其他对象链接以创建二进制文件。
或者,您可以在单个命令行中提供所有源文件,编译器将编译并链接它们:
avr-gcc -mmcu=atmega88 blinky.c print.c usb_debug_only.c
https://stackoverflow.com/questions/2978331
复制相似问题