0

I keep getting the error: make: *** [first] Error 1

I used this to make my makefile.

COMPILER = gcc CCFLAGS = -Wall -ansi -pedantic all: first first: first.o $(COMPILER) $(CCFLAGS) -o first first.o: first.o: first.c first.h $(COMPILER) $(CCFLAGS) -c first.c clean: rm -f first first.o 

It's a generic form that is suppose to work for our assignments. However, I can not get it to execute.

I don't know if

gcc: no input files 

Is part of the issue.

4
  • Please edit to fix the indentation in your Makefile. Commented Sep 27, 2015 at 1:01
  • This is an assignment and you are learning old ANSI-C? Huh! Change school. Commented Sep 27, 2015 at 1:43
  • Pot the whole error message, This is just one line and only tells make has encountered an error. Post a minimal reproducible example Commented Sep 27, 2015 at 1:44
  • That was the only error listed. Gcc: no input files filled by make:*** [first] error 1 Commented Sep 27, 2015 at 2:13

1 Answer 1

1

The problem is here:

$(COMPILER) $(CCFLAGS) -o first 

This will expand to something like gcc -Wall -ansi -pedantic -o first. Note that there are no input files specified, just as the error message says. You need to add first.o at the end.

Sign up to request clarification or add additional context in comments.

5 Comments

I fixed it and the error is gone. But first and first.o is not being removed.
@JavvaTheHutt: What do you mean?
I thought the directory is only suppose to have three files left at the end. First.h , first.c and makefile. First.o and first are still listed in the directory. Isn't that what the clean line is suppose to do? Remove them so they don't show up when command ls is used later.
Did you run "make clean"?
thanks! Tbh I'm not sure how makefiles work. Thank again

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.