【发布时间】:2020-11-24 17:18:14
【问题描述】:
我在运行 makefile 时遇到问题。问题是在运行 makefile 后出现错误
'linker' 输入未使用的 [-Wunused-command-line-argument]
错误截图:
此外,当我使用带有文件名的 make 命令时,这些命令运行良好,没有任何问题,并显示消息 file.o 是最新的,但是在 venting.o 和 venting 处提示错误
代码:
#declaring .PHONY rules
.PHONY: clean
#variable defined for -Wall -Wextra
CFLAGS=-Wall -Wextra
#rule to build the executable program venting from object file
venting: venting.o
gcc $(CFLAGS) -o venting venting.o
#list objectable file is created with the following rules.
list.o: list.c list.h
gcc $(CFLAGS) -c list.c
#list-adders objectable file is created with the following rules.
list-adders.o: list-adders.c list.h
gcc $(CFLAGS) -c list-adders.c
#vents objectable file is created with the following rules.
vents.o: vents.c list.h vents.h
gcc $(CFLAGS) -c vents.c
#venting.o objectable file is created with the following rules.
venting.o: list.o list-adders.o vents.o
gcc $(CFLAGS) -c list.o list-adders.o vents.o
#rule to remove all build targets and rebuild project from the beginning.
clean:
rm -f *.o venting
【问题讨论】: