本文介绍了make命令makefile中的错误:18:***缺少分隔符.停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于下面复制的以下make文件,我遇到了缺少的分隔符错误. Tabspace似乎没什么问题.

For the following make file copied below, I am getting the missing separator error. Nothing seems to be wrong with the tabspace.

OBJS = driver.o snapshot.o
SHOBJS = malloc.o mymemory.o
CC = g++
DEBUG = -g
CFLAGS = -Wall -c $(DEBUG)
LFLAGS = -Wall $(DEBUG)
Snapshot: $(OBJS)
  $(CC) $(LFLAGS) $(OBJS) -o Snapshot
driver.o: snapshot.h driver.cpp
  $(CC) $(CFLAGS) driver.cpp
snapshot.o: mymemory.h snapshot.h snapshot.cpp
  $(CC) $(CFLAGS) snapshot.cpp
libmymemory.so: $(SHOBJS)
  gcc -shared -o libmymemory.so malloc.o mymemory.o
malloc.o: malloc.c
  gcc -fPIC -g -c -Wall malloc.c
mymemory.o: mymemory.cpp
 gcc -fPIC -g -c -Wall mymemory.cpp
clean:
 \rm *.o *~ Snapshot

推荐答案

第18行是gcc -fPIC -g -c -Wall mymemory.cpp. Make期望使用分隔符,通常为:.它没有将这条线检测为命令.您没有正确输入意图:您在空格处应该有一个制表符.

Line 18 is gcc -fPIC -g -c -Wall mymemory.cpp. Make is expecting a separator, typically :. It's not detecting this line as a command. You mistyped the intendation: you have spaces where you should have a tab.

好的编辑器会突出显示以空格开头但看起来应该以制表符开头的makefile行.

Good editors highlight makefile lines that begin with spaces but look like they should begin with a tab instead.

这篇关于make命令makefile中的错误:18:***缺少分隔符.停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 04:15