Thanks for your help on my previous question, especially the comments on automatic rules. I'll experiment with those in due course. For now, I have added some include files. hello.cpp and inc1.h are in dir1, and inc2.h in dir2. The makefile is now
VPATH = dir1 dir2 CC = g++ OPTS = -c -O2 -Wall OBJS = hello.o hello : $(OBJS) $(CC) -o $@ $(OBJS) hello.o : hello.cpp inc1.h inc2.h $(CC) $(OPTS) $< -o $@ and the output of make is now g++ -c -O2 -Wall dir1/hello.cpp -o hello.o dir1/hello.cpp:6:18: fatal error: inc2.h: No such file or directory compilation terminated. make: *** [hello.o] Error 1 I don't understand why make doesn't find the prerequisite dir2/inc2.h. Any help would be most appreciated. _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make