On Jan 7, 9:16 am, Ishan <[EMAIL PROTECTED]> wrote: > On Jan 6, 7:34 am, Steve Calfee <[EMAIL PROTECTED]> wrote: > > > > CC = g++ > > > > vpath %.cpp .:../../parent/comp01 > > > That is not the syntax for vpath. Look in the make manual. A very good > > source ishttp://make.paulandlesley.org/ > > What's wrong here? What I'm trying to say here is, for any > prerequisite ending with .cpp, look either in the current directory or > in "../../parent/comp01" directory. This is how the manual says. Am I > wrong? > > Thanks, > Ishan.
I found what was wrong. The problem is that "make cannot use the appropriate path to the source if you hardcode the filename" [1]. When automatic variables are used as shown below, the problem is solved. CC = g++ VPATH = .:../../parent/comp01 CXXFLAGS = -ggdb -I ../../parent/comp01 OBJECTS = main.o Factory.o Context.o FactoryEx.o ContextEx.o comp01: $(OBJECTS) $(CC) $(OBJECTS) -o $@ clean: rm *.o comp01 [1] Managing Projects with GNU make, 3/e (Chap 02) <http://www.oreilly.com/catalog/make3/book/ch02.pdf> Cheers, Ishan De Silva -- Blogs are ideal for Personal Knowledge Bases -- [http://personal-knowledge-base.blogspot.com/]