gcc makefile错误:“没有规则做目标......” [英] gcc makefile error: "No rule to make target ..."
本文介绍了gcc makefile错误:“没有规则做目标......”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到了下面的错误,它似乎无法解释这个上下文:
没有规则来制作'vertex.cpp',这是'vertex.o'需要的。Stop。
这是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:顶点.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
解决方案
这通常是因为你不' t有一个名为 vertex.cpp
的文件可用。请检查:
- 该文件存在。
- 在制作时,您位于正确的目录中。
除此之外,我没有其他建议。也许你可以给我们一个该目录的目录列表。
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:
- that file exists.
- you're in the right directory when you make.
Other than that, I've not much else to suggest. Perhaps you could give us a directory listing of that directory.
这篇关于gcc makefile错误:“没有规则做目标......”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文