Makefile-缺少分隔符 [英] Makefile - missing separator
问题描述
可能重复:
出现错误:缺少分隔符
Possible Duplicate:
Make error: missing separator
将此代码保存在makefile中:
Have this code in makefile:
PROG = semsearch
all: $(PROG)
%: %.c
gcc -o $@ $< -lpthread
clean:
rm $(PROG)
和错误
missing separator. stop.
有人可以帮助我吗?
推荐答案
您需要在以gcc
和rm
开头的行之前添加一个硬标签.需要使用make规则中的命令以制表符开头(除非它们在同一行后跟分号).
结果应如下所示:
You need to precede the lines starting with gcc
and rm
with a hard tab. Commands in make rules are required to start with a tab (unless they follow a semicolon on the same line).
The result should look like this:
PROG = semsearch
all: $(PROG)
%: %.c
gcc -o $@ $< -lpthread
clean:
rm $(PROG)
请注意,某些编辑器可能被配置为插入空格序列而不是硬制表符.如果这些行的开头有空格,您还将看到缺少分隔符"错误.如果您在插入硬标签时确实遇到问题,请使用分号方式:
Note that some editors may be configured to insert a sequence of spaces instead of a hard tab. If there are spaces at the start of these lines you'll also see the "missing separator" error. If you do have problems inserting hard tabs, use the semicolon way:
PROG = semsearch
all: $(PROG)
%: %.c ; gcc -o $@ $< -lpthread
clean: ; rm $(PROG)
这篇关于Makefile-缺少分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!