Linux 生成文件中的错误:*** 缺少分隔符。停止
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14576237/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Errors in make file : *** missing separator. Stop
提问by Naseef Ur Rahman
I am facing errors in make file in CentOS 6.02 64 bit. I need to know what should be done to make the makefile workable. Any suggestion will be greatly helpful. My make file is pasted below: -
我在 CentOS 6.02 64 位的 make 文件中遇到错误。我需要知道应该怎么做才能使 makefile 可用。任何建议都会非常有帮助。我的制作文件粘贴在下面:-
#
.SUFFIXES: .cc $(.SUFFIXES)
ALL = libpal.a
#all = $(ALL)
all: $(ALL)
.cpp.o:
$(C++) -o $@ -c $(PROF) $(CFLAGS) $*.cpp
.cc.o:
$(C++) -o $@ -c $(PROF) $(CFLAGS) $*.cc
.c.o:
$(CC) -o $@ -c $(PROF) $(CFLAGS) $*.c
top_srcdir = ..
OPENSSL_LIB_DIR = ../../ThirdPartyLibs/openssl-0.9.8e/include
BOOST_DIR = ../../ThirdPartyLibs/boost/stage/lib
BOOST_INCLUDE_DIR = ../../ThirdPartyLibs/boost
CC = gcc
C++ = g++
CCOPT = -Os -Wall -Wno-deprecated
CCOPT_DEBUG = -Wall -g -Wno-deprecated
PROF =
STATIC = -static
INCLUDE = \
-I./usr/include/sys
-I./Headers \
-I$(top_srcdir)/PAL/Headers \
-I$(top_srcdir)/BaseMulti/Headers \
-I$(top_srcdir)/NetworkMulti/Headers \
-I$(top_srcdir)/RTP/Headers \
-I$(BOOST_INCLUDE_DIR) \
-I$(OPENSSL_LIB_DIR) \
LIBDIRS = \
-L$(BOOST_DIR) \
#XXX NLAYER define / MB_DEBUG
DEFINE = -D_LINUX -DDEBUGLOG -D_INDENT_DB_PRINT -fsigned-char -fno-inline -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_POSIX_PER_PROCESS_TIMER_SOURCE -D_PTHREADS -DUNICODE #-DDISABLE_LOG
SHLIB_SUFFIX = .so
SHLIB_LD = gcc -shared
SHLIB_LD_LIBS =
SHLIB_CFLAGS = -fPIC
BFLAGS = $(DEFINE) $(INCLUDE)
CFLAGS = $(CCOPT) $(BFLAGS)
OBJ_C =
OBJ_CC = \
./Sources/PALsystime.o \
./Sources/PALdebug.o \
./Sources/PALdebuglog.o \
./Sources/PALthread.o \
./Sources/PALcritsec.o \
./Sources/PALprofiler.o \
./Sources/PALserializable.o \
./Sources/PALinet.o \
./Sources/PALnetwork.o \
./Sources/PALsocket.o \
./Sources/PALlocalhostUdpEvent.o \
./Sources/PALpollarray.o \
./Sources/PALrandom.o \
OBJS = $(OBJ_C) $(OBJ_CC)
SRCS = $(OBJ_C:.o=.c) $(OBJ_CC:.o=.cc)
debug: DEFINE += -DDEBUG
debug: BFLAGS = $(DEFINE) $(INCLUDE)
debug: CFLAGS = $(CCOPT_DEBUG) $(BFLAGS)
debug: $(OBJS)
ar crsu libpal_debug.a $(OBJS)
libpal.a: $(OBJS)
ar crsu libpal.a $(OBJS)
cleandeps:
$(RM) ./Sources/*.o .depend* core
clean: cleandeps
$(RM) ./libpal.a ./libpal_debug.a
$(RM) $(ALL)
And the resultant error is:
由此产生的错误是:
Makefile:34: *** missing separator. Stop.
采纳答案by Reinier Torenbeek
You can find an explanation of this error in Appendix B Errors Generated by Make.
您可以在附录 B 由 Make 生成的错误中找到对此错误的解释。
Every line in a recipe must begin with a tab character. The recipes starting with $(C++)
and $(CC)
near the top of your file do not seem to start with a tab character.
配方中的每一行都必须以制表符开头。以文件顶部开头$(C++)
和$(CC)
附近的食谱似乎不是以制表符开头。
Additionally, the section
此外,该节
INCLUDE = \
-I./usr/include/sys
-I./Headers \
seems to be missing a backslash after sys
and that same section (and many more) have superfluous empty lines.
之后似乎缺少反斜杠,sys
并且同一部分(以及更多部分)有多余的空行。
回答by Aniket Thakur
Open your make file in vim rather than in editors like gedit. Every line in a recipe must begin with a tab character.
在 vim 而不是像 gedit 这样的编辑器中打开你的 make 文件。配方中的每一行都必须以制表符开头。
回答by entpnerd
This answer is for other Make
newbies such as myself who find this question from Googling and get stuck because they are modifying a large pre-existing Makefile, with no lines beginning with a space character. My problem occurred because a makefile in a subdirectorywith spaces instead of tabs was getting called by a parent makefile, where I erroneously thought the problem existed.
这个答案适用于其他Make
新手,例如我自己,他们从谷歌搜索中找到了这个问题并陷入困境,因为他们正在修改一个大型的预先存在的 Makefile,没有以空格字符开头的行。我的问题发生是因为父 makefile 调用了带有空格而不是制表符的子目录中的makefile,我错误地认为存在问题。
Once I fixed the makefile in the subdirectory, everything worked like a charm.
一旦我修复了子目录中的 makefile,一切都像魅力一样。