gnu.g++.help
[Top] [All Lists]

Re: gcc vs g++

Subject: Re: gcc vs g++
From: Dave Seaman
Date: Thu, 5 Jan 2006 13:38:31 +0000 UTC
Newsgroups: gnu.g++.help
On 5 Jan 2006 00:17:17 -0800, Chris wrote:
> I've been trying to compile some code.  When I type the following in
> the command line, I get a bunch of errors:

> cspears@bws-31:/imports/home/cspears/Documents/C++/myCode/chap04/ex04>
> gcc struct.cpp test.cpp

You need to use g++, not gcc, when compiling C++ programs.

> However, when I type g++, everything works well:

Correct.

> cspears@bws-31:/imports/home/cspears/Documents/C++/myCode/chap04/ex04>
> g++ struct.cpp test.cpp
> cspears@bws-31:/imports/home/cspears/Documents/C++/myCode/chap04/ex04>
> ls
> a.out  struct.cpp  struct.cpp~  struct.h  struct.h~  test.cpp
> test.cpp~
> cspears@bws-31:/imports/home/cspears/Documents/C++/myCode/chap04/ex04>
> ./a.out
> 5

> Why is this?  I thought g++ and gcc were the same.

The program may be the same, but that doesn't mean the program can't look
at the name that was used to invoke it and process things accordingly.



-- 
Dave Seaman
U.S. Court of Appeals to review three issues 
concerning case of Mumia Abu-Jamal.
<http://www.mumia2000.org/>

<Prev in Thread] Current Thread [Next in Thread>