In MAKE file : error showing no such file or directory

时间:2015-04-23 05:35:29

标签: c gcc makefile

I have simple Makefile. When I run make I get following error:

gcc  -I -o server server.o comfunc.o

gcc: error: comfunc.o: No such file or directory

make: *** [server] Error 1

My Makefile:

 CC=gcc

 CFLAGS=-I

AIM = server

HEADS = ../common/common.h

OBJS = comfunc.o

MOBJ = server.o

MISCS = server.cfg

SRCS = ${OBJS:.o=.c} ${MOBJ:.o=.c}

#targets
all: $(AIM)


server:server.o

        $(CC) $(LDFLAGS) $(CFLAGS) -o server server.o $(OBJS) $(LIBS)

#dependency
$(OBJS):../common/common.h

comfunc.o: ../common/common.h

#--End of Makefile--

1 个答案:

答案 0 :(得分:1)

添加$(OBJS)和$(MOBJ)作为服务器的依赖项,这将确保implicit Makefile rules被执行,从而产生相应的Parallel s

请参阅下面的Makefile

.o