AVR-GCC“needed by 'xx.elf'”编译错误解决方案
初次使用AVR-GCC/WINavr,使用VC++6.0做IDE,尝试编译程序时候总是出现如下错误:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
-------- begin --------
avr-gcc (GCC) <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />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.
make.EXE: *** No rule to make target `obj/main.o', needed by `avrtest2.elf'. Stop.
工具返回代码: 2
注意红字部分的描述
编译的时候,已经使用WinAVR自带工具MFile生成需要的Makefile文件,并且已经将Makefile文件加入到当前工程中(见附图1)
解决此错误方法如下:
# Target file name (without extension).
TARGET = avrtest2
# Object files directory
OBJDIR = obj
# List C source files here. (C dependencies are automatically generated.)
SRC =
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC = main.cpp
下面(在当前工程所包含的makefile文件中)将红字部分改成如下:
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c
# List C++ source files here. (C dependencies are automatically generated.)
#CPPSRC = main.cpp
也就是上面那个加了一个$(TARGET).c
下面那个加了一个#号,把后面语句给注释掉
其他的不用动
保存
执行make clean
再执行make all
Visual c++ 6.0输出窗口已经没有上述错误提示了,编译问题搞定,下面就可以专心写程序了~~~
另外要注意,源程序文件名要和makefile中定义的target名字要一致
用户273179 2010-6-3 17:00