命令

2013-06-05 59 views
1

這是我的C++的Makefile我在我的UNIX上運行:命令

# 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沒有問題,我查了一下。 Thanx!

+1

如果你打算試試,在makefile的第1行使用shebang:'#!/ usr/bin/make -f'。 –

+0

哦,我愛的上帝...... >>。<< – 2013-06-05 17:46:47

回答

4

您必須運行make命令,該命令將拾取makefile並執行其操作。它看起來像你試圖執行makefile本身。

+0

上帝!你是對的! TNX! – user2456678