Reputation: 23
What can I do to fix this problem? I'm trying to make a make file that will compile guess.cpp and yesno.cpp to produce the files guess.o and yesno.o, and will link those two .o files to produce an executable program named guess. This is my makefile here:
guess: yesno.o guess.o
g++ -o guess yesno.o guess.o
guess.o: yesno.h
yesno.o: yesno.h
The error I am getting it
make: *** No rule to make target `yesno.h', needed by `yesno.o'. Stop.
Can anyone explain to me what is wrong and what I can do to fix this.
Upvotes: 0
Views: 778
Reputation: 2915
The basic makefile rule is
target: dependencies
[tab] system command
You miss the [tab] system command
part. Try this below. And this is simple tutorial about Makefile.
guess: yesno.o guess.o
g++ -o guess yesno.o guess.o
guess.o: yesno.h guess.c
g++ -c guess.c
yesno.o: yesno.h yesno.c
g++ -c yesno.c
Upvotes: 1