www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/13/08:58:54

From: kagel AT quasar DOT bloomberg DOT com
Date: Mon, 13 May 1996 08:51:50 -0400
Message-Id: <9605131251.AA01462@quasar.bloomberg.com >
To: freak AT uci DOT edu
Cc: djgpp AT delorie DOT com
In-Reply-To: <31963d26.984061@news.service.uci.edu> (freak@uci.edu)
Subject: Re: Compiling .cpp files with DJGPP GXX
Reply-To: kagel AT dg1 DOT bloomberg DOT com

   From: freak AT uci DOT edu (Jerry Wen)
   Date: Sun, 12 May 1996 19:55:57 GMT

   Hello.  I am new to DJGPP and C++ programming, and I would like to
   know how to compile a C++ file using GXX.  I have been using VC++ v4
   for a while, and after a friend's recommendation, I decided to learn
   how to compile on the command line to learn the whole process
   first-hand.  The readme.1st doc only described how to compile C++
   object codes, and then compile object codes into executables, but I
   have now clue as to what object code is.  Would any kind DJGPP user
   explain how to accomplish this, before I convert all of my C++ source
   into C (yuck!)?

OK:

	gcc -c mystuff.cc

produces an object code file, mystuff.o.  To link object files together into 
an executable you could use the linker, ln, directly:


, but, gcc can handle the linking for you, thus:

	gcc -o myprogram mystuff.o myutils.o -lgpp

or you could do this in one step, compile and link:

	gcc -o myprogram mystuff.cc myutils.cc -lgpp

There is also a shorthand for C++ compile/links which would releive you from
having to remember to add the -lgpp for the c++ libraries.  The gxx utility, 
included with DJGPP since the Feb. release, I believe, will do this for you:

	gxx -o myprogram mystuff.cc myutils.cc

-- 
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com

A proverb is no proverb to you 'till life has illustrated it.  -- John Keats

- Raw text -


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