D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] A programming problem



On Wed, 2003-05-07 at 23:44, Tom Glare wrote:

> The plot thickens !  One would think that if the compiler was going to
> complain, it would pick on the other two lines which do the same thing.
> But it only happens in the switch statement. "g++ -v" gives me "gcc
> version 2.96".  Yes, ignore the silly program - the problem came up in a
> much more complicated program - this example was just the simplest I could
> come up with to illustrate the problem.
> 

I have been caught out with the command GCC not recognizing C++ and
treating the file as C.  This generally leads my programs to spew up a
load of linking problems.  By using G++ you say "Hey look compiler, its
C++", even though g++ is part of the GCC suite itself.


the info page for GCC says

"
  G++ is a _compiler_, not merely a preprocessor.  G++ builds object
code directly from your C++ program source.  There is no intermediate C
version of the program.  (By contrast, for example, some other
implementations use a program that generates a C program from your C++
source.)  Avoiding an intermediate C representation of the program means
that you get better object code, and better debugging information.  The
GNU debugger, GDB, works with this information in the object code to
give you comprehensive C++ source-level editing capabilities (*note C
and C++: (gdb.info)C.).
"



> Cheers, Tom.
> 
> 
> --
> The Mailing List for the Devon & Cornwall LUG
> Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
> message body to unsubscribe.
-- 
James Ogden <zemned@xxxxxxxxxx>


--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly