I'm trying to use GCC (linux) with a makefile to compile my project.
I get the following error which is can't seem to decipher in this context:
"No rule to make target 'vertex.cpp', needed by 'vertex.o'.  Stop." This is the makefile:
a.out: vertex.o edge.o elist.o main.o vlist.o enode.o vnode.o     g++ vertex.o edge.o elist.o main.o vlist.o enode.o vnode.o  main.o: main.cpp main.h     g++ -c main.cpp  vertex.o: vertex.cpp vertex.h     g++ -c vertex.cpp  edge.o: edge.cpp edge.h     g++ -c num.cpp  vlist.o: vlist.cpp vlist.h     g++ -c vlist.cpp  elist.o: elist.cpp elist.h     g++ -c elist.cpp  vnode.o: vnode.cpp vnode.h     g++ -c vnode.cpp  enode.o: enode.cpp enode.h     g++ -c node.cpp No rule to make target generally means simply that you have a compiler version that does not match the original compiler used in the project. You only need to go to the project properties and change the compiler to use the one you installed. Another reason could be that you moved the project or files to another folder.
Answer: The message is formatted as: *** No rule to make target 'file supposed to be input', needed by 'the file going to make'. That is, no rules are defined to locate the input file. This error occurs when there are errors or inconsistencies in build configurations.
A 'make target' is basically a file that you want rebuilt. Make can't divine what you want built, so you have to tell it, implicitly or explicitly, what it should build.
What Makefiles Contain. Makefiles contain five kinds of things: explicit rules , implicit rules , variable definitions , directives , and comments . Rules, variables, and directives are described at length in later chapters. An explicit rule says when and how to remake one or more files, called the rule's targets.
That's usually because you don't have a file called vertex.cpp available to make. Check that:
Other than that, I've not much else to suggest. Perhaps you could give us a directory listing of that directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With