gpt4 book ai didi

c - 在 C 中创建 Makefile 时遇到问题

转载 作者:行者123 更新时间:2023-11-30 17:56:33 25 4
gpt4 key购买 nike

这是我在 Ubuntu 中从终端创建 makefile 时收到的错误:

~/Desktop/a4 $ make
cc Makefile.c -o Makefile
Makefile.c:1:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
make: *** No targets specified and no makefile found. Stop.
OBJ = Source.o
OPTIONS = -g

a4: Source.c
gcc $(OPTIONS) -o a4 $(OBJ)

Source.o: myHeader.h Source.c
gcc $(OPTIONS) -c Source.c

clean:
rm -f $(OBJ) a4

package:
tar -cvf myAssmt.tar *.c *.h Makefile

源代码是 a4 文件夹中的 .c 文件,我的 makefile 是同一文件夹中的 Makefile.c。

最佳答案

没有 .c 的 Makefile 解决了我的问题。谢谢大家!

关于c - 在 C 中创建 Makefile 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13442132/

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