make提示missing separator但是vi设置了tab,还有请大神帮我看看Makefile有没有其他错误 10
extcutable=myprogramlinkcc=$(cc)cppflags=ldflags=cc=gcccflags=-Wall-02cxx=g++cxxflags...
extcutable = myprogram
linkcc = $(cc)
cppflags =
ldflags =
cc = gcc
cflags = -Wall -02
cxx = g++
cxxflags = $(cflags)
srcs := $(wildcard *.c) $(wildcard *.cc) $(wildcard *.C)
objs := $(patsubst %.c, %.o, $(wildcard *.c)) \
$(patsubst %.cc, %.o, $(wildcard *.cc)) \
$(patsubst %.C, %.o, $(wildcard *.c))
deps := $(patsubst %.o, %.d, $(objs))
all: $(executable)
$(executable): $(deps) $(objs)
$(linkcc) $(ldflags) -o $(executable) $(objs)
%.d: %.c
$(cc) -M $(cppflags) % < > $@
$(cc) -M $(cppflags) % < | sed s/ \ \ .o/.d/ > $@
%.d: %.C
$(cxx) -M $(cppflags) % < > $@
$(cxx) -M $(cppflags) % < | sed s/ \ \ .o/.d/ > $@
%.d: %.cc
$(cxx) -M $(cppflags) % < > $@
$(cxx) -M $(cppflags) % < | sed s/ \ \ .o/.d/ > $@
clean:
-rm $(objs) $(executable) $(deps) * -
explain:
@echo"Final executable name: $(executable)"
@echo"Source files: $(srcs)"
@echo"Object files: $(objs)"
@echo"Dependncy files: $(deps)"
depend: $(deps)
@echo"Dependencies are now up-do-date"
-include $(deps)
请大神帮我看下 展开
linkcc = $(cc)
cppflags =
ldflags =
cc = gcc
cflags = -Wall -02
cxx = g++
cxxflags = $(cflags)
srcs := $(wildcard *.c) $(wildcard *.cc) $(wildcard *.C)
objs := $(patsubst %.c, %.o, $(wildcard *.c)) \
$(patsubst %.cc, %.o, $(wildcard *.cc)) \
$(patsubst %.C, %.o, $(wildcard *.c))
deps := $(patsubst %.o, %.d, $(objs))
all: $(executable)
$(executable): $(deps) $(objs)
$(linkcc) $(ldflags) -o $(executable) $(objs)
%.d: %.c
$(cc) -M $(cppflags) % < > $@
$(cc) -M $(cppflags) % < | sed s/ \ \ .o/.d/ > $@
%.d: %.C
$(cxx) -M $(cppflags) % < > $@
$(cxx) -M $(cppflags) % < | sed s/ \ \ .o/.d/ > $@
%.d: %.cc
$(cxx) -M $(cppflags) % < > $@
$(cxx) -M $(cppflags) % < | sed s/ \ \ .o/.d/ > $@
clean:
-rm $(objs) $(executable) $(deps) * -
explain:
@echo"Final executable name: $(executable)"
@echo"Source files: $(srcs)"
@echo"Object files: $(objs)"
@echo"Dependncy files: $(deps)"
depend: $(deps)
@echo"Dependencies are now up-do-date"
-include $(deps)
请大神帮我看下 展开
1个回答
展开全部
在编写makefile后,make项目时提示错误“Makefile:3: *** missing separator. Stop.”
偶然发现这个错误是有makefile中的tab的长度导致的,在makefile中的命令需要以tab键开始,
在.vimrc文件中发现没有设置tab键的默认长度,然后在.vimrc中添加如下配置后,
set tabstop=4
便可以执行makefile了, 但是后来发现不管再次把tabstop设置成8还是注释掉这个配置,makefile都可以执行,很奇怪,不知道为什么?
这是从 网络上搜索到的 看看对你是否用用???????
偶然发现这个错误是有makefile中的tab的长度导致的,在makefile中的命令需要以tab键开始,
在.vimrc文件中发现没有设置tab键的默认长度,然后在.vimrc中添加如下配置后,
set tabstop=4
便可以执行makefile了, 但是后来发现不管再次把tabstop设置成8还是注释掉这个配置,makefile都可以执行,很奇怪,不知道为什么?
这是从 网络上搜索到的 看看对你是否用用???????
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询