Mail Archives: djgpp/1999/03/10/10:07:52
In article <NNGNBEDNPMGICAAA AT mailcity DOT com> you wrote:
> Hi,
> I am copiling template class called stack.cpp
> and test.cpp uses stack class.
> which means test.o have to be dependent on not only test.cpp and
> stack.h but stack.o too...
I'm quite sure you've got this wrong. No .o file can ever depend on
another .o file. Not unless you're linking .o files together by hand,
for some arcane efficiency reason, or the compiler you use is doing
some *real* weird things you're not telling us about, like use another
.o file to get template instantiation stuff resolved. I would consider
such behaviour braindead, if it exists.
> like:
> test.o: test.cpp stack.h stack.o
That should never have to be more than
test.o: test.cpp stack.h
Anything beyond that, like explicit dependency on stack.cpp or stack.o,
must result from incorrect usage of the #include statement, I think.
> and the following command is used for unix machine.
> cxx -c -g -w0 test.cpp
> but how am i supposed to let the DJGPP compiler know this kind of
> dependency ?
DJGPP uses Makefiles as well, so where's the problem???
My version of your Makefile, adapted to use for DJGPP, would look like
this, roughly:
--- begin ---
CXX=gxx
LD=CXX
CXXFLAGS = -g -Wall -O2
stack_test: test.o stack.o
$(LINK.cc) -o $@ $^
test.o: test.cc stack.h
stack.o: stack.cc stack.h
--- end ---
If this doesn't work (setting aside possible bugs or typos, as I can't
test this Makefile, currently), then the problem most probably is in
your code, not in the Makefile.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -