delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/06/18:22:15

From: ryot AT bigfoot DOT com (George Ryot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: using make2
Message-ID: <37d52114.9642650@news.clara.net>
References: <37D3885F DOT AC003BA2 AT postoffice DOT pacbell DOT net>
X-Newsreader: Forte Agent 1.5/32.452
X-No-Archive: yes
MIME-Version: 1.0
Lines: 73
Date: Mon, 06 Sep 1999 20:29:44 GMT
NNTP-Posting-Host: 195.8.91.17
X-Complaints-To: abuse AT clara DOT net
X-Trace: nnrp3.clara.net 936649784 195.8.91.17 (Mon, 06 Sep 1999 21:29:44 BST)
NNTP-Posting-Date: Mon, 06 Sep 1999 21:29:44 BST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019