【发布时间】:2015-02-13 01:12:02
【问题描述】:
我在同一个项目目录下有很多makefile。
Makefile_prune:
OBJS = main.o
SOURCE = main.cpp
HEADER = Division_Euclidean_space.h Find_diameter.h Find_k_max.h Householder.h IO.h Mean_variance.h Point.h Random_generator.h Random_kd_forest.h Tree.h
OUT = rkd
CC = g++
FLAGS = -std=c++0x -O3 -c -Wall
# -c flag generates object code for separate files
all: $(OBJS)
$(CC) $(OBJS) -o $(OUT)
make clean
# create/compile the individual files >>separately<<
main.o: main.cpp
$(CC) $(FLAGS) main.cpp
.PHONY : all
# clean house
clean:
rm -f $(OBJS)
# do a bit of accounting
count:
wc $(SOURCE) $(HEADER)
我收到了清理错误,如下所示:
samaras@samaras-A15:~/code$ make -f Makefile_prune
g++ -std=c++0x -O3 -c -Wall main.cpp
g++ main.o -o rkd
make clean
make[1]: Entering directory `/home/samaras/paper/rkd_forest/code'
make[1]: *** No rule to make target `clean'. Stop.
make[1]: Leaving directory `/home/samaras/paper/rkd_forest/code'
make: *** [all] Error 2
然后我可以运行make -f Makefile_prune clean,它将执行清理工作,但我想要单人命令,我的意思是,不必按两次回车。
相关答案:
- “make clean” results in “No rule to make target `clean'”
- gcc makefile error: “No rule to make target …”
想法:
makefile 实际上是用于我的 C 项目的,我只是做了一些更改以适应 C++,也许这就是问题所在。
【问题讨论】: