Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Compilation AVR_GCC编译错误延迟.h_Compilation_Avr Gcc_Atmel - Fatal编程技术网

Compilation AVR_GCC编译错误延迟.h

Compilation AVR_GCC编译错误延迟.h,compilation,avr-gcc,atmel,Compilation,Avr Gcc,Atmel,Teensy++v.2的gcc部分中的说明。Makefile和blinky.c在zip中。我通过在开始时定义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

Teensy++v.2的gcc部分中的说明。Makefile和blinky.c在zip中。我通过在开始时定义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'
$avr gcc-mmcu=atmega88 blinky.c
在blinky.c:28中包含的文件中:
/usr/local/lib/gcc/avr/4.2.2/../../../../../../../../../../avr/include/util/delay.h:90:3:警告:#警告“编译器优化已禁用;中的函数无法按设计工作”
/tmp//ccB66ecl.o:在函数“main”中:
blinky.c:(.text+0x3e):对“usb_init”的未定义引用
/tmp//ccB66ecl.o:在函数“莫尔斯字符”中:
blinky.c:(.text+0x24c):对“print\P”的未定义引用
blinky.c:(.text+0x36e):对“print\P”的未定义引用
blinky.c:(.text+0x378):未定义对“usb_debug_putchar”的引用
blinky.c:(.text+0x37e):对“print\P”的未定义引用
blinky.c:(.text+0x386):对“print\P”的未定义引用
blinky.c:(.text+0x390):未定义对“usb_debug_putchar”的引用
blinky.c:(.text+0x394):未定义对“usb_debug_putchar”的引用
blinky.c:(.text+0x416):对“print\P”的未定义引用
blinky.c:(.text+0x4fa):对“print\P”的未定义引用
blinky.c:(.text+0x6f8):未定义对“print\P”的引用
/tmp//ccB66ecl.o:在函数“morse\u P”中:
blinky.c:(.text+0x834):对“print\P”的未定义引用

这些是链接错误。您只能进行编译(注意,我添加了
-c
标志):

然后必须将其与其他对象链接以创建二进制文件

或者,您可以在单个命令行中提供所有源文件,编译器将编译并链接它们:

avr-gcc -mmcu=atmega88 blinky.c print.c usb_debug_only.c

你所说的“你必须把它和你的其他对象链接起来才能创建一个二进制文件”是什么意思?AFAIU程序必须为十六进制才能上载到Atmel芯片。@user355926-您是正确的,在上载之前,程序必须为
ihex
格式。但是在创建
ihex
文件之前,您仍然需要链接程序。@R:如何链接它?我在
$manhextump
中找不到有关
ihex
的任何信息。如何获取十六进制文件?
avr-gcc -mmcu=atmega88 blinky.c print.c usb_debug_only.c