【发布时间】:2011-08-07 18:52:21
【问题描述】:
这是 Eclipse 控制台的输出:
**** Build of configuration Debug for project FatFstest ****
make all
make: *** No rule to make target `main.o', needed by `FatFstest.elf'. Stop.
我正在尝试使用 Eclipse 的 AVR 插件构建一个项目来测试 FatFs 库。我首先导入了 FatFs 代码,然后创建了 main.c 文件来实现它。在我第一次尝试构建它之后,我将我的项目的 src 文件夹添加到我的 Properties > AVR Compiler > Directories 中的目录列表中,但我仍然收到构建错误。有什么帮助吗?
这是我的生成文件:
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include src/subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(ASM_DEPS)),)
-include $(ASM_DEPS)
endif
ifneq ($(strip $(S_DEPS)),)
-include $(S_DEPS)
endif
ifneq ($(strip $(S_UPPER_DEPS)),)
-include $(S_UPPER_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
LSS += \
FatFstest.lss \
SIZEDUMMY += \
sizedummy \
AVRDUDEDUMMY += \
avrdudedummy \
# All Target
all: FatFstest.elf secondary-outputs
# Tool invocations
FatFstest.elf: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: AVR C Linker'
avr-gcc -Wl,-Map,FatFstest.map -mmcu=atmega328p -o"FatFstest.elf" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
FatFstest.lss: FatFstest.elf
@echo 'Invoking: AVR Create Extended Listing'
-avr-objdump -h -S FatFstest.elf >"FatFstest.lss"
@echo 'Finished building: $@'
@echo ' '
sizedummy: FatFstest.elf
@echo 'Invoking: Print Size'
-avr-size --format=avr --mcu=atmega328p FatFstest.elf
@echo 'Finished building: $@'
@echo ' '
avrdudedummy: FatFstest.elf
@echo 'Invoking: AVRDude'
/usr/local/CrossPack-AVR-20100115/bin/avrdude -pm328p -Uflash:w:FatFstest.hex:a
@echo 'Finished building: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(OBJS)$(C_DEPS)$(ASM_DEPS)$(ELFS)$(LSS)$(AVRDUDEDUMMY)$(S_DEPS)$(SIZEDUMMY)$(S_UPPER_DEPS) FatFstest.elf
-@echo ' '
secondary-outputs: $(LSS) $(SIZEDUMMY) $(AVRDUDEDUMMY)
.PHONY: all clean dependents
.SECONDARY:
-include ../makefile.targets
main.c
#include <diskio.h>
#include <ff.h>
#include <stdio.h>
int main(void)
{
printf("hello world\n");
return 0;
}
子目录.mk
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/diskio.c \
../src/ff.c \
../src/main.c
OBJS += \
./src/diskio.o \
./src/ff.o \
./src/main.o
C_DEPS += \
./src/diskio.d \
./src/ff.d \
./src/main.d
# Each subdirectory must supply rules for building sources it contributes
src/%.o: ../src/%.c
@echo 'Building file: $<'
@echo 'Invoking: AVR Compiler'
avr-gcc -I"/Users/nathannewcomb/Documents/Puzzles/FatFstest/src" -Wall -g2 -gstabs -O0 -fpack-struct -fshort-enums -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega328p -DF_CPU=1000000UL -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -c -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
objects.mk
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
USER_OBJS :=
LIBS :=
sources.mk
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
O_SRCS :=
C_SRCS :=
S_UPPER_SRCS :=
S_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
OBJS :=
C_DEPS :=
ASM_DEPS :=
ELFS :=
LSS :=
AVRDUDEDUMMY :=
S_DEPS :=
SIZEDUMMY :=
S_UPPER_DEPS :=
# Every subdirectory with source files must be described here
SUBDIRS := \
src \
【问题讨论】:
-
您能否通过将您的makefile 减少到引发问题所需的最小 来隔离问题?目前,我们看不到所有这些包含的内容,等等。
-
检查 $(OBJS) 或 $(USER_OBJS) 是否有规则将 main.cc 编译为 main.o。只需在包含的所有 make 文件中搜索“main”并跟踪编译“树”,以便它可以构建 main.o。也许您必须添加一条规则!
-
@Oli 对不起。我刚刚发布了eclipse自动生成的makefile。你能更具体地说明你想要什么吗?我很困惑。
-
@Nathan:我的意思是,makefile 太复杂了,这里的任何人都无法在不访问它使用的所有包含文件的情况下进行调试,也无法访问您的环境。最好的办法是手动编辑 makefile 以找出问题的原因。
-
我看到您现在已经发布了包含文件的内容。我有点困惑,因为
$(OBJS)包含./src/main.o,但您发布的错误消息仅涉及main.o(没有其余路径)。