Mail Archives: djgpp/1999/09/06/18:22:15
> thank you for responding.
> I'll bet better at this with a little practice
you didn't need to start a new thread for this.
> the make file...
The commands appear to be indented by only a space, but that could
just be the post, you need to use TABs for the makefile to work.
> exp : date1.o emply1.o fig07_04.o
> gxx -o exp.exe date1.o emply1.o fig07_04.o
That seems ok to me, though you don't actually need the .exe extension
for the target (and sometimes it's easier without).
> date1.o : date1.cpp date1.h
> g++ -o date1.cpp emply1.cpp fig07_04.cpp
>
> emply1.o : emply1.cpp emply1.h date1.h
> g++ -o emply1.cpp
>
> fig07_04.o : fig07_04.cpp emply1.h
> g++ -o fig07_04.cpp
AFAIK there isn't a g++ in the standard DJGPP distribution.
I think you mean -c (to produce object files from the sources) rather
than -o which sets the output file and overwrites your source!
The command to build date1.o (if it were correct) would also produce
objects from the other two sources, this won't directly result in an
error but it is unecessary and could lead to confusion.
> why would it work only once?
It is difficult to see how it worked at all, if this wasn't a straight
cut-n-paste then please post again.
Do your source files still exist!?
I think this is the makefile you intended:
exp: date1.o emply1.o fig07_04.o
gxx -o exp date1.o emply1.o fig07_04.o
date1.o: date1.cpp date1.h
gxx -c date1.cpp
emply1.o: emply1.cpp emply1.h date1.h
gxx -c emply1.cpp
fig07_04.o: fig07_04.cpp emply1.h
gxx -c fig07_04.cpp
Of course there are many alternatives, you could use:
CXX = gxx
exp: date1.o emply1.o fig07_04.o
$(CXX) $(LDFLAGS) $^ $(LDLIBS) -o $@
date1.o: date1.h
emply1.o: emply1.h date1.h
fig07_04.o: emply1.h
Hope that is of some help.
--
george
- Raw text -