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
debug_main.o
. Since you seem to be compiling a C program, it means you probably want it to find a filedebug_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.$(info make running in $(CURDIR))
to your makefile: just put it as the first line by itself. See what it says. If thedebug_main.c
file you created is not in that directory, that's the problem.