0

这是我在 Ubuntu 中从终端创建生成文件时收到的错误:

~/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。

4

1 回答 1

0

没有 .c 的 Makefile 解决了我的问题。多谢你们!

于 2012-11-18T19:03:14.647 回答