这个案例已经打开了很多次,我检查了所有的答案,但并没有真正帮助。
我在这里发布它可能有人可以帮助我。
我的工作架构是:
| ( I'm Here )
+- matamzone.c
+- amountset.c
+- product.c
+- order.c
+- matamzone.h
+- amount.h
+- p.h
+- order.h
+- TEST-folder
+- amount_set_main.c
+- amount_set_main.h
+- amount_set_tests.c
+- amount_set_tests.h
makefile 必须通过编写 make amount_set 来支持运行 amount_set_main.c。
我的制作文件代码:
CC = gcc
COMP_FLAGS = -std=c99 -Wall -pedantic-errors -Werror -DNDEBUG
COMP_NEW = -std=c99 -Wall -pedantic-errors -Werror -DNDEBUG /tests
OUR_FILES = amount_set.c matamazom.c order.c product.c matamazom_print.c
OUR_NFILES = amount_set_main.c amount_set_test.c
OBJS = amount_set.o matamazom.o order.o product.o matamazom_print.o
TEST_OBJS = amount_set_main.o amount_set_test.o
EXEC = matamazom.exe
TESTROOMEXE = amount_set
$(TESTROOMEXE) : $(TEST_OBJS)
$(CC) -o $@ $(COMP_FLAGS) $(TEST_OBJS) -L. -lmtm
matamazom.o: matamazom.c matamazom.h list.h product.h order.h amount_set.h matamazom_print.h
$(CC) -c $(COMP_FLAGS) $(OUR_FILES) $*.c
amount_set.o: amount_set.c amount_set.h
$(CC) -c $(COMP_FLAGS) $(OUR_FILES) $*.c
order.o: order.c order.h amount_set.h
$(CC) -c $(COMP_FLAGS) $(OUR_FILES) $*.c
product.o: product.c matamazom.h
$(CC) -c $(COMP_FLAGS) $(OUR_FILES) $*.c
matamazom_print.o: matamazom_print.c matamazom_print.h
$(CC) -c $(COMP_FLAGS) $(OUR_FILES) $*.c
amount_set_main.o: amount_set_main.c amount_set_tests.h test_utilities.h
$(CC) -c $(COMP_NEW) $(OUR_NFILES) $*.c
amount_set: amount_set_main.c amount_set_tests.h amount_set.h
$(CC) -o $@ $(COMP_NEW) $(TEST_OBJS) -L. -lmtm
amount_set_test.o: amount_set_tests.c amount_set_tests test_utilities.h ../amount_set.h
$(CC) -c $(COMP_NEW) $(OUR_NFILES) $*.c
clean:
rm -f $(OBJS) $(EXEC) $(TESTS) $(TEST_O)
出于某种原因,我得到:
**make: *** No rule to make target `amount_set_main.c', needed by `amount_set_main.o'. Stop.**
任何帮助:(