ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/04/05/04:49:45

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3CAD6C24.495D4F57@phekda.freeserve.co.uk>
Date: Fri, 05 Apr 2002 10:19:32 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: DJGPP newsgroup <djgpp AT delorie DOT com>
Subject: Re: making dxe2gen with clio.rice.edu binaries -or- "undefined reference
to 'operator'"?
References: <3ca78d87$0$364$9b622d9e AT news DOT freenet DOT de> <a8eoih$m9u$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <3cab2f26$0$152$9b622d9e AT news DOT freenet DOT de> <Pine DOT GSO DOT 4 DOT 44 DOT 0204040850130 DOT 10680-100000 AT mozart DOT orchestra DOT cse DOT unsw DOT EDU DOT AU> <3cace922$0$12701$9b622d9e AT news DOT freenet DOT de>
Reply-To: djgpp AT delorie DOT com


deckerben wrote:
> Some compilers know, for instance, that they should automaticly try a full
> C++ convention with source files that have the .cpp file extension, and an
> ANSI C convention when they end with .c
> But my DJGPP installation was trying to compile a C++ file only using
> default C libraries. Appearantly DJGPP does not support this
> 'file-extension-recognition', or?

Compiling and linking are different things. When you link with with
gpp/gxx/g++ it will automatically link in the standard C++ library, e.g.:

    gxx -o foo foo.o bar.o

Similarly gcc will link in the standard C library.

Now if you link multiple C++ object files together using:

    gcc -o foo foo.o bar.o

then how does gcc know you're linking C++ objects together? Answer: it
doesn't. So you need to use gpp/gxx/g++ instead.

Note that if you compile and link a C++ program in one line, then gcc knows it
should link in the standard C++ library, because it knows its C++ from the
file extension:

    gcc -g -Wall -o foo foo.cpp


Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -

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