delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/05/00:11:15

Message-Id: <199809050410.AAA27994@delorie.com>
Comments: Authenticated sender is <mert0407 AT sable DOT ox DOT ac DOT uk>
From: "George Foot" <george DOT foot AT merton DOT oxford DOT ac DOT uk>
To: Jason <jpsaave AT sandia DOT gov>
Date: Sat, 5 Sep 1998 05:09:08 +0000
MIME-Version: 1.0
Subject: Re: Follow Up: Why doesn't C++ work!?!?!
Reply-to: mert0407 AT sable DOT ox DOT ac DOT uk
CC: djgpp AT delorie DOT com

On  4 Sep 98 at 17:39, Jason wrote:

> Well, I tried using gxx and it worked!  It kinda pisses me off that
> DJGPP never gives examples of compiling C++ progs from the command line
> - I was given the impression that I only needed to use gcc and it would
> do everything for me, since that's what the DJGPP User's Guide said on
> the website.  I guess that's what you can expect from a free compiler
> huh?  :O)

The file `readme.1st' describes how to install and use djgpp to 
compile and link C and C++ programs.  `gcc' knows when compiling that 
C++ programs need to go through the C++ compiler, not the C compiler 
-- that's what it decides based upon the filename (`*.c' are C source 
code, `*.C *.cc *.cpp' are C++ source code).

At link time however, C and C++ programs all boil down to a
collection of object files, and the linker needs to be told which
libraries to link in.  By default it links in the standard C library
but not the C++ library.  If you want the C++ library you should use
g++ or gxx, just as you would on Unix, or specify the C++ library
explicitly on the gcc command line.

If you use the RHIDE integrated development environment, I believe
it will decide what to link based upon your source file's extension.

-- 
george DOT foot AT merton DOT oxford DOT ac DOT uk

- Raw text -


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