我正在尝试为我的项目编写一个make文件,我正在尝试使用
调试问题make -n
命令,我终于把它归结为
致命错误:无法创建/bin/st_driver.o:权限被拒绝
我不能为我的生活找出正在发生的事情。
我的代码是
CC=gcc
CFLAGS=-g -Wall
TARGETS=st_driver
.PHONY: all clean dist
all: ./${TARGETS}
st_driver: bin/st_driver.o bin/st.o bin/er.o bin/hashtable.o
${CC} ${CFLAGS} -o st_driver bin/st_driver.o bin/st.o bin/er.o bin/hashtable.o
bin/st_driver.o: src/drivers/st_driver.c src/include/st.h
${CC} ${CFLAGS} -o /bin/st_driver.o -c src/drivers/st_driver.c
bin/st.o: src/st/st.c src/include/st.h
${CC} ${CFLAGS} -c src/st/st.c -o bin/st.o
bin/er.o: src/er/er.c src/include/er.h
${CC} ${CFLAGS} -c src/er/er.c -o bin/er.o
bin/hashtable.o: src/util/hashtable.c src/include/hashtable.h
${CC} ${CFLAGS} -c src/util/hashtable.o -o bin/hashtable.o
bin/list.o: src/util/list.c include/list.h
${CC} ${CFLAGS} -c src/util/list.c -o bin/list.o
clean:
rm -rf bin/*
run_valgrind: ${TARGETS}
valgrind -v --leak-check=yes bin/CS480_pcc
答案 0 :(得分:5)
问题在这里:
bin/st_driver.o: src/drivers/st_driver.c src/include/st.h
${CC} ${CFLAGS} -o /bin/st_driver.o -c src/drivers/st_driver.c
您指的是/bin/st_driver.o
,并且您想引用bin/st_driver.o
。