gpt4 book ai didi

c - 制作 : Nothing to be done for `all'

转载 作者:太空狗 更新时间:2023-10-29 16:15:27 27 4
gpt4 key购买 nike

我正在通过一个 eg pgm 来创建一个 make 文件。

http://mrbook.org/tutorials/make/

我的文件夹 eg_make_creation 包含以下文件,

desktop:~/eg_make_creation$ ls
factorial.c functions.h hello hello.c main.c Makefile

生成文件

# I am a comment, and I want to say that the variable CC will be
# the compiler to use.
CC=gcc
# Hwy!, I am comment no.2. I want to say that CFLAGS will be the
#options I'll pass to the compiler
CFLAGS=-c -Wall

all:hello

hello:main.o factorial.o hello.o
$(CC) main.o factorial.o hello.o -o hello

main.o:main.c
$(CC) $(CFLAGS) main.c

factorial.o:factorial.c
$(CC) $(CFLAGS) factorial.c

hello.o:hello.c
$(CC) $(CFLAGS) hello.c

clean:
rm -rf *o hello

错误:

desktop:~/eg_make_creation$ make all
make: Nothing to be done for `all'.

请帮助我理解编译这个程序。

最佳答案

有时“Nothing to be done for all”错误可能是由 makefile 规则中命令前的空格而不是制表符引起的。请确保您在规则中使用制表符而不是空格。

all:
<\t>$(CC) $(CFLAGS) ...

代替

all:
$(CC) $(CFLAGS) ...

有关规则语法说明,请参阅 GNU make 手册:https://www.gnu.org/software/make/manual/make.html#Rule-Syntax

关于c - 制作 : Nothing to be done for `all' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8561640/

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