jatin
jatin

Reputation: 39

executable is not created during makefile execution

#! bin/bash
CC=gcc
CFLAGS=-I.
DEPS=p.h

%.o: %.c $(DEPS)
        $(CC) -c -o $@ $< $(CFLAGS)
hello:p1.o p2.o
        gcc hello p1.o p2.o -I. 

the error showing during the the make of makefile is shown below

gcc hello p1.o p2.o -I.
gcc: error: hello: No such file or directory
make: *** [hello] Error 1

executable is not created after makefile execution,but the obnject files are created

Upvotes: 0

Views: 42

Answers (2)

emesday
emesday

Reputation: 6186

If your output is hello, change to

hello:p1.o p2.o
    gcc p1.o p2.o -I. -o $@ 

Upvotes: 1

Mohit Jain
Mohit Jain

Reputation: 30489

Change gcc hello p1.o p2.o -I. to gcc p1.o p2.o -o hello

Upvotes: 2

Related Questions