Mail Archives: djgpp/1998/01/04/15:42:56

Message-Id: <>
From: "John Machin" <sjmachin AT lexicon DOT net DOT au>
To: djgpp AT delorie DOT com
Date: Mon, 5 Jan 1998 07:38:01 +1000
MIME-Version: 1.0
Subject: Book "Practical C++ Programming" / examples / DJGPP format
CC: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>

Background: Been using C since BDS C running on CP/M. Been using 
DJGPP C since version 1.something. New to C++. I got a copy of above 
book (author is Steve Oualline, publisher is O'Reilly & Associates) 
as a present. I've downloaded the source (DOS version) examples from 
the O'Reilly web site.

DOS version has files with .cpp extensions, and makefiles for Borland 
C++, Turbo C++, MS, generic Unix, and "GNU".
The "GNU" makefiles are closest to what's required for DJGPP. Here's 
a typical makefile.gnu (minus comments) for a single source-file 

=== start of makefile.gnu
CFLAGS=-g -Wall
all: array

        $(CC) $(CFLAGS) -o array

        rm array
=== end of makefile.gnu

Some changes would be needed:
(1) (a) CC = gcc, CFLAGS += -lgpp -lstdcx 
	[**** FAQ BUG *** see below]
    (b) CC = gxx
(2) File extension conflict (files are called foo.cpp, makefile uses

Before I launch into awk / perl / shell-utilities to lash up a bulk 
fix-up, I have some questions:

(1) Has anyone already done this?
(2) Which is a "better" naming convention to use for C++ source 
files generally, or foo.cpp?
(3) Has Q2 just started a holy war?
(4) As most of the examples involve a single source file, I think 
I'll just write a mak.bat that compiles & links the or %1.cpp 
file, and fiddle the remaining makefiles by hand; this will save some 
disk space; any comments?

Here's the (very minor) FAQ bug:

> The Standard C++ Template classes are in `libstdcx.a' (it's called 
> `libstdc++.a' on Unix); append `-lstdcxx.'

Happy New Year to all,

John Machin
1/27 Auburn Grove
Hawthorn East, VIC 3123, Australia
Phone: +61-3-98130561

- Raw text -

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