-1

I have a task to debug a given project. When trying to build the makefile by the terminal, I can do it easily but, when trying to build a target with Makefile tools, I am getting the following error:

  • Executing task: 'make' 'program' '-f' '/home/dor/Desktop/Dor/Ex1/A_1/Debug_code/Makefile'
make: *** No rule to make target 'debug_main.o', needed by 'program'.  Stop.

This is my makefile (that was given to me with the task:

CC = gcc 
CFLAGS = -Wall -g # -g flag is used to enable debugging information
all: program
program : debug_main.o
    $(CC) $^ -o $@ -lm
clean:
    rm -f *.o program

Also my makefile tools settings: enter image description here

2
  • 2
    Please don't post images, or even less good, links to other sites containing images, when asking questions on SO. As for your question, this means that make couldn't find a way to build debug_main.o. Since you seem to be compiling a C program, it means you probably want it to find a file debug_main.c and it can't find one. Assuming you actually did write a file with that name, I will assume that the file is in some other directory than the directory in which you invoked make. You need to start make in the same directory as your source code, with that Makefile. Commented Nov 26 at 20:06
  • 2
    To find out what directory make was invoked in, you can add something like $(info make running in $(CURDIR)) to your makefile: just put it as the first line by itself. See what it says. If the debug_main.c file you created is not in that directory, that's the problem. Commented Nov 26 at 20:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.