c - Makefile 未执行,错误需要符号

标签 c makefile

刚刚尝试编写一个由 5 个文件组成的 makefile --> arrays.h arrays.c 指针.h 指针.c stringtest.c

但是,当我运行 make 时,我收到错误,期望“=”,“,”“;”等等,然后它又说没有指定目标。有什么想法吗?

stringtest : stringtest.c arrays.o pointers.o
    cc -std=c99 -Wall -pedantic -Werror -o stringtest stringtest.c arrays.o pointers.o 

arrays.o : arrays.c arrays.h
    cc -std=c99 -Wall -pedantic -Werror -c -o arrays.o arrays.c

pointers.o : pointers.c pointers.h
    cc -std=c99 -Wall -pedantic -Werror -c -o pointers.o pointers.c

最佳答案

您使用制表符进行缩进吗? 针对目标的命令必须与其缩进。喜欢:

pointers.o: ...
---->cc -std=c99 ..

关于c - Makefile 未执行,错误需要符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46619485/

相关文章:

linux - 如果补丁跳过补丁,如何不破坏 makefile?

c++ - 为什么在尝试编译我的第一个 CORBA 服务器(使用 ACE/TAO ORB 实现)时会出现链接器错误?

c - 内核模块中的调试堆栈溢出

c - 如何使用结构体指针分配结构体成员数组?

C - 这个语法是关于什么的? <<

c++ - 自编辑 Makefile

c++ - GNU Make - 动态创建的变量名

c - 在使用 fgets() 填充后,如何从我的字符串数组中删除换行符 "\n"?

c - 如何用指针交换项目

c - DESTDIR 和 PREFIX 的 make