从生成文件编译错误:"Unable to open output file" ..."No such file or directory"

Compiling error from Makefile: "Unable to open output file"…"No such file or directory"

本文关键字:file output open No directory or such to Unable 文件 编译      更新时间:2023-10-16

我在网上找到了一个项目(复活一个旧机器人(,我想把它集成到我正在做的事情中,但我在编译makefile时遇到了问题。我总是以错误告终:

c++-c src/Apps/speechSynth.cpp-o obj/speechSynth.o-Isrc

错误:无法打开输出文件"obj/speechSynth.o":"没有这样的文件或目录">

该文件为:https://github.com/jvalentine-20000/hero-pi.git

我很难看到makefile有问题?我是不是错过了什么?

根据错误消息(与我的附录一起(:

unable to open output file 'obj/speechSynth.o': 'No such file or directory'
^^^^^^^^^^^^

由于这是一个输出文件(来自-o(,所以它几乎是,当然是,因为您没有obj目录。我建议创建一个。

事实上,由于Makefile应该为您完成所有工作,我建议更改命令序列,以便您执行:

mkdir -p obj

在编译之前。这应该确保目录在尝试使用之前存在。