Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make: *** No rule to make target `main.o'

here is the output from the console in Eclipse:

 **** Build of configuration Debug for project FatFstest ****

make all 
make: *** No rule to make target `main.o', needed by `FatFstest.elf'.  Stop.

I am trying to build a project using the AVR plugin for Eclipse to test the FatFs library. I first imported the FatFs code then created main.c file to implement it. After I tried building it the first time, I added the src folder of my project to my the directories list in Properties > AVR Compiler > Directories, and I still get the build error. Any help?

Here is my makefile:

################################################################################
# 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;
 }

subdir.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 \
like image 485
Nathan Avatar asked Aug 07 '11 18:08

Nathan


1 Answers

It happened to me too, simply moving main.cpp in an another folder.

I try to clean out the project, but the problem persist, so I have deleted Debug folder, re-compile and it works!

like image 86
Luca Davanzo Avatar answered Sep 22 '22 13:09

Luca Davanzo