日期:2014-05-16  浏览次数:20782 次

g++编译多文件问题了!
g++编译多文件问题了!


makefile文件是   linearlist_mf
[root@localhost   ~]#   cat   linearlist_mf
#main文件在./DataStrueture/listmain.cpp     的目标“DataStrueture/listmain.cpp”。   #linearlist.cpp   调用的头文件在./DataStructure/include/linearlist.h
#linearlist.cpp   在./DataStructure/listmain.cpp
#main文件yaya   :listmain.o   linearlist.opp
#linearlg++   -o   yaya   listmain.o   linearlist.ore/include/linearlist.h
#linearllistmain.o:./DataStrueture/listmain.cpp   ./DataStructure/include/linearli   st.h   :listmain.o   linearlist.o
                g++   -c   ./DataStructure/listmain.cpp
listmainlinearlist.o:./DataStructure/linearlist.cpp     ./DataStructure/include/lin   earlist.h++   -c   ./DataStructure/listmain.cpp

make   错误呢
[root@localhost   ~]#   make   -f   linearlist_mf
linearlist_mf:4:   ***   commands   commence   before   first   target。   停止。  

错在哪的呢?makefile文件错了的?


------解决方案--------------------
jf
------解决方案--------------------
INCLUDE = -I./DataStructure/include

MAIN = listmain
CC = /usr/bin/gcc

SOURCES = listmain.c
OBJS = $(MAIN).o $(SOURCES:.c=.o)

all: $(PROGS)
.c.o:
$(CC) -c $(INCLUDE) $ < -o $@

$(PROGS): $(OBJS)
$(CC) -o $(PROGS) $(OBJS)