gpt4 book ai didi

c - Makefile:没有规则来制作目标 '*.o' ,需要 '*' 。停止

转载 作者:太空宇宙 更新时间:2023-11-04 00:47:12 32 4
gpt4 key购买 nike

出现以下错误

make: *** No rule to make target `stretchy_buffer.o', needed by `tsh'.  Stop

尝试制作这个makefile

SRCS = stretchy_buffer.c def.c tsh_builtin_commands.c tsh_jobs.c tsh_main.c tsh_routines.c tsh_signals.c
OBJS = $(SRCS:.c=.o)

tsh: $(OBJS)
gcc -Wall -g -o tsh $(OBJS)

最佳答案

您需要在您的 makefile 中添加以下规则:

CFLAGS = -Wall -g

%.o:%.c
gcc $(CFLAGS) $< -o $@

在你现有的makefile中,没有指定从*.c文件中获取*.o的规则,因此报错。

关于c - Makefile:没有规则来制作目标 '*.o' ,需要 '*' 。停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33315155/

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