[AVR单片机] 求助undefined reference to `main'

[复制链接]
 楼主| 四叶草 发表于 2007-5-5 16:42 | 显示全部楼层 |阅读模式
我想建一个有多个文件的工程,在makefile那里已经设置了TARGET =motor和SRC =lcd.c,而且motor.c里面还包括了“lcd.h”,但是在编译时出现了如下内容:
Linking: motor.elf
avr-gcc -mmcu=atmega8 -I. -gdwarf-2 -DF_CPU=100000UL  -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=lcd.o  -std=gnu99 -MD -MP -MF .dep/motor.elf.d lcd.o --output motor.elf -Wl,-M
ap=motor.map,--cref    -lm
e:/WinAVR/bin/../lib/gcc/avr/3.4.6/../../../../avr/lib/avr4/crtm8.o: In function `__vectors':
../../../../../avr-libc-1.4.4/crt1/gcrt1.S:51: undefined reference to `main'
make: *** [motor.elf] Error 1
究竟是什么问题呢?费解中……求助
liweisdut 发表于 2014-5-16 10:55 | 显示全部楼层
解决了吗?我也遇到这个问题啊
liweisdut 发表于 2014-5-16 11:00 | 显示全部楼层
我找到原因了。我的是因为main.c是空的
divinitus 发表于 2014-6-7 23:41 | 显示全部楼层
在Makefile的SRC字段中加入所有C文件名
divinitus 发表于 2014-6-7 23:42 | 显示全部楼层
liweisdut 发表于 2014-5-16 10:55
解决了吗?我也遇到这个问题啊

在Makefile的SRC字段中加入所有C文件名
您需要登录后才可以回帖 登录 | 注册

本版积分规则

71

主题

109

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部