这是我在UNIX上运行的C ++ Makefile:
# This is a Makefile for the SocNetwork project
CCC = g++
CXXFLAGS = -Wall -g
CXXLINK = $(CCC)
OBJS = Message.o Date.o main.o SocialNetwork.o User.o
RM enter code here= rm -f
all: SocNetwork
# Creating the executable (SocNetwork)
SocNetwork: $(OBJS)
$(CXXLINK) -o SocNetwork $(OBJS)
# Creating object files using default rules
Date.o: Date.C Date.H
main.o: main.C SocialNetwork.H User.H defs.H Date.H Message.H
Message.o: Message.C Message.H defs.H
SocialNetwork.o: SocialNetwork.C SocialNetwork.H User.H defs.H Date.H Message.H
User.o: User.C User.H defs.H Date.H Message.H
# Cleaning old files before new make
clean:
$(RM) SocNetwork screen_test *.o *.bak *~ "#"* core
当我在UNIX中运行makefile时,我得到:
./makefile: line 2: CCC: command not found
./makefile: line 3: CXXFLAGS: command not found
./makefile: line 4: CCC: command not found
./makefile: line 4: CXXLINK: command not found
./makefile: line 5: OBJS: command not found
./makefile: line 6: RM: command not found
./makefile: line 7: all:: command not found
./makefile: line 9: OBJS: command not found
./makefile: line 9: SocNetwork:: command not found
./makefile: line 10: CXXLINK: command not found
./makefile: line 10: OBJS: command not found
./makefile: line 10: -o: command not found
./makefile: line 12: Date.o:: command not found
./makefile: line 13: main.o:: command not found
./makefile: line 14: Message.o:: command not found
./makefile: line 15: SocialNetwork.o:: command not found
./makefile: line 16: User.o:: command not found
./makefile: line 18: clean:: command not found
./makefile: line 19: RM: command not found
./makefile: line 19: SocNetwork: command not found
有谁能告诉我我的makefile有什么问题? Tabs没有问题,我查了一下。 感谢名单!!!
答案 0 :(得分:4)
您必须运行make
命令,该命令将获取makefile
并执行其操作。看起来你正在尝试执行makefile本身。