gcc makefile error: "No rule to make target ..."
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
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.
In my experience, this error is frequently caused by a spelling error.
I got this error today.
make[1]: *** No rule to make target maintenaceDialog.cpp', needed by
maintenaceDialog.o'. Stop.
In my case the error was simply a spelling error. The word MAINTENANCE was missing it's third N.
Also check the spelling on your filenames.
The more common reason for this message to be printed is because you forgot to include the directory in which the source file resides. As a result, gcc "thinks" this file does not exist.
You can add the directory using the -I argument to gcc.
链接地址: http://www.djcxy.com/p/61432.html