So I have an assignment where I am supposed to create an oop that will run on a provided Unix server.
I have a Mac so when I run the makefile in Terminal, I don't get any errors. But when I try to run the makefile in the provided Unix server, I get this error:

make: *** No rule to make target `Horse.cpp', needed by `Horse.o'.  Stop.

So can someone explain or show me what I am doing wrong? Here are the contents of the makefile:

horserace: Horse.o Race.o main.o
    g++ Horse.o Race.o main.o -o horserace
main.o: main.cpp Race.h Horse.h
    g++ -c main.cpp Horse.cpp Race.cpp
Horse.o: Horse.cpp Horse.h
    g++ -c Horse.cpp
Race.o: Race.cpp Race.h Horse.h
    g++ -c Race.cpp
    rm -rf *.o horserace

Any help will be most appreciated.


Recommended Answers

All 4 Replies

It means that Horse.cpp is not present (at least, in the directory where you run make). What does the ls output look like?

make: *** No rule to make target Horse.cpp', needed byHorse.o'. Stop.

I had to emphasize that ls (ell-es) is a command. Run it in the directory whe you run make, and post the output here.

It turns out that I had the capitalization wrong. It is working fine now. Thanks for the info though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.