This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Differences from gcc-2.95 to gcc-2.97


>-----Original Message-----
>From: Mohamed Ezz [mailto:ezz@peregrine.com]
>Sent: 22 March 2001 16:11

>Thanks David, g++ worked and I wasn't using gcc for any special reason
>except that it was in our makefiles for years. I always thought they
>are the same (one is a symbolic link to the other or something). Could
>you point to a doc that describes the differences between gcc and g++?


    Hi Ezz,

  The docs don't have a lot to say on the subject.  AFAIK, the only
difference is that g++ passes extra -l flags to the linker for the C++
libraries.  It must also add a few pre-defined macros.  The simplest way
to get an idea what the differences are is to try compiling your program
with both gcc and g++, and add the -v flag to the command: that will 
show you the predefines passed to the preprocessor, extra libs passed to
the linker, and any other relevant differences in the way the two drivers
control the subprograms of gcc.

  In the documentation, all I could find was this extract from the
manual/info pages:

Compiling C++ Programs
======================

   C++ source files conventionally use one of the suffixes `.C', `.cc',
`.cpp', `.c++', `.cp', or `.cxx'; preprocessed C++ files use the suffix
`.ii'.  GCC recognizes files with these names and compiles them as C++
programs even if you call the compiler the same way as for compiling C
programs (usually with the name `gcc').

   However, C++ programs often require class libraries as well as a
compiler that understands the C++ language--and under some
circumstances, you might want to compile programs from standard input,
or otherwise without a suffix that flags them as C++ programs.  `g++'
is a program that calls GCC with the default language set to C++, and
automatically specifies linking against the C++ library.  On many
systems, the script `g++' is also installed with the name `c++'.

   When you compile C++ programs, you may specify many of the same
command-line options that you use for compiling programs in any
language; or command-line options meaningful for C and related
languages; or options that are meaningful only for C++ programs.  *Note
Options Controlling C Dialect: C Dialect Options, for explanations of
options for languages related to C.  *Note Options Controlling C++
Dialect: C++ Dialect Options, for explanations of options that are
meaningful only for C++ programs.


       DaveK
-- 
 All your base are belong to us!


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]