By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,918 Members | 2,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,918 IT Pros & Developers. It's quick & easy.

g++ and gcc

P: n/a
What is the different of g++ and gcc ???

I wrote a cpp file include iostream
however, i have error to compile in gcc
but it can be compile without error in g++
why ??
Jul 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Dragon wrote:
What is the different of g++ and gcc ???


This is off topic here, but iirc the difference is that gcc will by default
invoke the C compiler, why g++ will invoke the C++ compiler. <iostream> is a
C++ header, so naturally you can't use it when compiling C.

--
Unforgiven
Jul 22 '05 #2

P: n/a
Dragon wrote in news:3f********@storm.i-cable.com:
What is the different of g++ and gcc ???

I wrote a cpp file include iostream
however, i have error to compile in gcc
but it can be compile without error in g++
why ??


You should really ask this in a gnu/gcc newsgroup/forum
(news://gnu.gcc.help I think).

g++ automagicly links the standard C++ libraries, with gcc you
have to tell it you want to link to these libraries (-lstdc++ IIRC).
Rob.
--
http://www.victim-prime.dsl.pipex.com/
Jul 22 '05 #3

P: n/a
Hi,

By the process of poking various fingers onto keys Unforgiven generated
this:
Dragon wrote:
What is the different of g++ and gcc ???


This is off topic here, but iirc the difference is that gcc will by default
invoke the C compiler, why g++ will invoke the C++ compiler. <iostream> is a
C++ header, so naturally you can't use it when compiling C.


Not quite. gcc stands for gnu compiler collection. You can run g++ by
itself. Equally, you can compiled source using gcc as well.

For example

gcc foo.c will compile foo.c
gcc foo.cpp with compile the C++ file foo
g++ foo.cpp does the same
gcc foo.f77 (or .for) will compile the FORTRAN file foo
g77 foo.f77 (or .for) will do the same.

In otherwords, gcc is just the frontend to the various backends.

TTFN

Paul

--
One OS to fool them all
One browser to find them
One email client to bring them all
And through security holes, blind them...

Jul 22 '05 #4

P: n/a
Paul F. Johnson wrote:
Hi,

By the process of poking various fingers onto keys Unforgiven generated
this:
Dragon wrote:
What is the different of g++ and gcc ???


This is off topic here, but iirc the difference is that gcc will by
default invoke the C compiler, why g++ will invoke the C++ compiler.
<iostream> is a C++ header, so naturally you can't use it when compiling
C.


Not quite. gcc stands for gnu compiler collection. You can run g++ by
itself. Equally, you can compiled source using gcc as well.

For example

gcc foo.c will compile foo.c
gcc foo.cpp with compile the C++ file foo
g++ foo.cpp does the same
gcc foo.f77 (or .for) will compile the FORTRAN file foo
g77 foo.f77 (or .for) will do the same.

In otherwords, gcc is just the frontend to the various backends.


Yes, but use g++ for C++ anyway because g++ automatically supplies the
required C++ information whereas gcc does not. From a newbie aspect, this
is of particular importance for the linker phase, ie: in a makefile, drive
the linker via $(CXX) not via $(CC). ;-)
--
Guy Harrison
Jul 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.