这是我的makefile:

all:ll

ll:ll.c   
  gcc  -c  -Wall -Werror -02 c.c ll.c  -o  ll  $@  $<

clean :
  \rm -fr ll

当我尝试make clean或make make时,我得到这个错误:

:makefile:4: *** missing separator.  Stop.

我该怎么解决呢?


当前回答

关键点是“HARD TAB”

检查是否使用TAB而不是空格 检查.vimrc中的set tabstop=X

其他回答

如果你的编辑器/IDE支持它(很可能是支持的!),帮你自己一个忙,让它成为你的.editorconfig的永久成员。

[Makefile]
indent_style = tab

如果你在eclipse中编辑你的Makefile:

Windows-> Preferences->General->Editor->Text Editors->Show Whitespace Characters -> Apply

或使用下面显示的快捷方式。

Tab用灰色“>>”表示,Space用灰色“.”表示,如下图所示。

使用.editorconfig自动修复选项卡:

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4

[Makefile]
indent_style = tab

这是因为制表符被空格取代。 若要禁用此功能,请转到

中- >编辑- >首选项- >编辑器

并删除检查

"用空格替换制表符"

关键点是“HARD TAB”

检查是否使用TAB而不是空格 检查.vimrc中的set tabstop=X