public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eljay Love-Jensen <eljay@adobe.com>
To: Sampath Kumar Herga <sherga@airvananet.com>, gcc-help@gcc.gnu.org
Subject: Re: Gcc/g++
Date: Wed, 13 Jul 2005 16:26:00 -0000	[thread overview]
Message-ID: <6.2.1.2.2.20050713112311.022519b8@iplan-mn.corp.adobe.com> (raw)

Hi Sampath,

>What is the difference between gcc and g++ when compiling c++ files.

gcc is the tool-chain driver for compiling C files.

g++ is the tool-chain driver for compiling C++ files.

You can use the '-v' flag to enable verbose mode, which will give you more details what's going on behind the scenes.

The details do differ from OS to OS, and from GCC version to GCC version.  So I can't be more specific than that given the information you've provided.

>Also if we have a mix of c and c++ files in a project, which is the better compiler to use?

In general, I suggest making your C files C++ files with the minimal amount of work possible.  That "minimal amount of work" often is "no work whatsoever" or "merely renaming Foo.c to Foo.cpp", since C++ is a mostly compatible superset of C.

That's not always easily possible, though.  Ergo...

If you prefer to keep your C files as C files (i.e., C ABI for the object code), then you'll have to do a bit of work to make the C header files properly digestable in C++ land.  Annotating the globally linked identifiers with extern "C".  Making sure you never throw an exception over the C barrier.  Yada yada yada.

HTH,
--Eljay

             reply	other threads:[~2005-07-13 16:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-13 16:26 Eljay Love-Jensen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-07-14  8:59 Gcc/g++ Sampath Kumar Herga
2005-07-14 13:30 ` Gcc/g++ Ishwar Rattan
2005-07-13 15:48 Gcc/g++ Sampath Kumar Herga
2005-07-13 15:53 ` Gcc/g++ random

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6.2.1.2.2.20050713112311.022519b8@iplan-mn.corp.adobe.com \
    --to=eljay@adobe.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=sherga@airvananet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).