【发布时间】:2010-10-24 12:00:23
【问题描述】:
我正在尝试使用带有 makefile 的 GCC (linux) 来编译我的项目。
我收到以下错误,在这种情况下似乎无法破译:
"No rule to make target 'vertex.cpp', needed by 'vertex.o'. Stop."
这是生成文件:
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
【问题讨论】:
-
一个典型的例子是你'使'源文件'不存在'是通过错误地重置VPATH或SRC变量当你必须添加到它。我的意思是使用
VPATH=而不是VPATH+=。这使得 Makefile 文件在文件实际存在时无法看到文件。