gpt4 book ai didi

c - 让: *** No rule to make target `clean' .停止

转载 作者:行者123 更新时间:2023-11-30 18:12:45 25 4
gpt4 key购买 nike

我正在走过this教程,我必须在其中创建此 make 文件:

 CFLAGS=-wall  -g

clean:
rm -f ex1

当我输入此命令时:

$ make clean

我收到以下错误:

make: *** No rule to make target `clean'.  Stop.

我确定我正在使用 TABS。为什么我会收到此错误?怎么解决呢?

最佳答案

这里的问题,正如帖子中的一些评论所表明的那样,您将文件命名为 make 而不是传统的 Makefile (或备用名称 GNUMakefile GNU make 支持的 makefile)。

参见What Name to Give Your Makefile在 GNU make 手册中。

如果您想使用备用名称(例如 make),那么您需要告诉 make 使用 -f 来使用该文件标志(也在手册的该部分中提到)。

make -f make

缺少分隔符错误是由 makefile 中的缩进不正确引起的。配方行等上用空格代替制表符。

关于c - 让: *** No rule to make target `clean' .停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31704764/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com