JavvaTheHutt
JavvaTheHutt

Reputation: 195

Makefile error 1

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.

Upvotes: 0

Views: 4160

Answers (1)

John Zwinck
John Zwinck

Reputation: 249552

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.

Upvotes: 1

Related Questions