gcc makefile 错误:“没有规则可以制作目标......" [英] gcc makefile error: "No rule to make target ..."

查看:42
本文介绍了gcc makefile 错误:“没有规则可以制作目标......"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用带有 makefile 的 GCC (linux) 来编译我的项目.

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."

这是生成文件:

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

推荐答案

这通常是因为您没有可以创建名为 vertex.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.

这篇关于gcc makefile 错误:“没有规则可以制作目标......"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆