oatabc 发表于 2008-5-28 13:07:45

按照新手入门步骤,编译老是出错,不知为什么?请高手解答!谢谢

你好,我想请教你一个问题,我刚使用 Winavr,我用的是2006.4.21版本的,在按照新手入门的步骤下,一步一步做,可出现这样的问题,
-------- begin --------
avr-gcc (GCC) 3.4.6
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling C: main.c
avr-gcc -c -mmcu=atmega16 -I. -gdwarf-2 -DF_CPU=UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wundef -Wa,-adhlns=obj/main.lst-std=gnu99 -Wundef -MD -MP -MF .dep/main.o.d main.c -o obj/main.o
In file included from main.c:2:
C:/WinAVR/avr/include/util/delay.h: In function `_delay_us':
C:/WinAVR/avr/include/util/delay.h:154: error: `UL' undeclared (first use in this function)
C:/WinAVR/avr/include/util/delay.h:154: error: (Each undeclared identifier is reported only once
C:/WinAVR/avr/include/util/delay.h:154: error: for each function it appears in.)
C:/WinAVR/avr/include/util/delay.h: In function `_delay_ms':
C:/WinAVR/avr/include/util/delay.h:179: error: `UL' undeclared (first use in this function)
make: *** Error 1

我试了几次,都是这样.以前我也编译过,它能通过,但现在就不行。不知道为什么?郁闷。能帮我解决一下吗?

mljda 发表于 2008-5-28 14:31:19

没有包含delay.h

建议使用新版本。
使用avrstdio+winavr

AvrStdio的IDE直接支持GCC的。

yyccaa 发表于 2008-5-28 14:52:53

-DF_CPU=UL,时钟频率未指定。

oatabc 发表于 2008-5-29 11:20:22

谢谢上面的两位.我现在通过在stdio中调用GCC再编译上面的程序,通过了。我还有一个问题就是,在新建工程时,Creat initial file要不要钩选啊?它代表什么意思呀?因为我在论坛里看到说不要钩选它,我现在两种情况都做了,结果都是一样的。我不知道它们之间到底有没有差别?

sem521562 发表于 2008-8-20 13:03:55

我的是这样的问题/ util/delay.h: No such file or directory不知是不是版本问题。
页: [1]
查看完整版本: 按照新手入门步骤,编译老是出错,不知为什么?请高手解答!谢谢