2012-05-07 67 views
0

我想使用GCC(linux)與makefile來編譯我的項目。 我得到以下錯誤:gcc makefile錯誤:「沒有規則,使目標...」

% make map 
make: *** No rule to make target `map'. Stop. 

沒有任何一個有那會是什麼想法?

這是生成文件:

CC = gcc 
DEBUG_FLAG = -g 
COMP_FLAG = -std=c99 -Wall -Werror -pedantic-errors -DNDEBUG 

LIB = -L. -lmtm 
MAP_OBJS = map.o 
USER_OBJS = user.o 
NETWORK_OBJS = network.o 
ISOCIAL_OBJS = network.o user.o Isocial.o 
PARSING_OBJS = user.o network.o map.o Isocial.o mtm_isocial.o 

PARSING = parsing 
MAP_TEST = map_example_test 
ISOCIAL_TEST = Isocial_test 
NETWORK_TEST = network_test 
USER_TEST = user_test 

TEST_PATH = ./tests/ 

$(PARSING) : $(PARSING_OBJS) 
    $(CC) $(DEBUG_FLAG) $(PARSING_OBJS) $(LIB) -o [email protected] 
$(MAP_TEST) : $(MAP_OBJS) 
    $(CC) $(DEBUG_FLAG) $(MAP_OBJS) $(LIB) -o [email protected] 
$(ISOCIAL_TEST) : $(ISOCIAL_OBJS) 
    $(CC) $(DEBUG_FLAG) $(ISOCIAL_OBJS) $(LIB) -o [email protected] 
$(USER_TEST) : &(USER_OBJS) 
    $(CC) $(DEBUG_FLAG) $(USER_OBJS) $(LIB) -o [email protected] 
$(NETWORK_TEST) : $(NETWORK_OBJS) 
     $(CC) $(DEBUG_FLAG) $(MAP_OBJS) $(LIB) -o [email protected] 

map.o: map.c map.h mtm_ex2.h 
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c 
isocial.o: Isocial.c user.h mtm_ex2.h set.h network.h list.h Isocial.h 
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c 
parsing.o: parsing.c Isocial.h parsing.h mtm_ex2.h 
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c 
network.o: network.c network.h set.h mtm_ex2.h 
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c 
user.o:user.c user.h set.h mtm_ex2.h 
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c 
user_test.o: user_test.c ../test_utilities.h ../user.h ../mtm_ex2.h \ 
    ../set.h 
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $(TEST_PATH)$*.c 
Isocial_test.o: Isocial_test.c ../test_utilities.h ../Isocial.h 
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c $(TEST_PATH)$*.c 
map_example_test.o: map_example_test.c ../test_utilities.h ../map.h 
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c $(TEST_PATH)$*.c 
network_test.o: network_test.c ../test_utilities.h ../network.h ../set.h \ 
    ../mtm_ex2.h 
    $(CC) -c $(DEBUG_FLAG) $(COMP_FLAG) $*.c $(TEST_PATH)$*.c 

EXEC = $(PARSING) $(MAP_TEST) $(ISOCIAL_TEST $(USER_TEST) $(NETWORK_TEST) 

tests : $(MAP_TEST) $(ISOCIAL_TEST) $(USER_TEST) $(NETWORK_TEST) 

isocial : $(PARSING) 

clean: 
    rm -f $(PARSING_OBJS) $(EXEC) 

回答

3

的錯誤信息是正確的:我看到一個目標map.o,但沒有目標map,這看起來像

map: map.o 
    something something something 

有目標用於名爲parsing,map_example_test,network_testIsocial_test的程序;也許你想建立其中的一個?

如果您只是鍵入make,它會生成程序parsing,因爲這是該文件中的第一個目標。

相關問題