Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

stupid g++ question



  This code still compiles for me.  I'm using Red Hat 7.2 with all updates.
BTW: I find it amazing that people are still referring to Red Hat's 2.96
release of GCC as 'bastardized' and other sometimes derogatory terms.  I
guarantee you that things like this will keep cropping with 2.95 and some 3.0
releases.  That's not to say that this can't be fixed or isn't some genuine
installation problem, just that a stock Red Hat 7.2 + updates compiles it
fine.  For further information on Red Hat's 2.96 release of GCC, read
http://www.bero.org/gcc296.html.
  What distribution and compiler/library version are you using again?

On Thu, Mar 14, 2002 at 12:59:44PM -0500, Jerry Feldman wrote:
> You are right, here is the source I am concerned about:
> #include <iostream.h>
> #include <string>
> int main()
> {
>         string s;
>         s = "Hello, world!";
>         cout << s << "\n";
> }
> It was a cut/paste error, and I didn't catch it. 
> On 14 Mar 2002 at 11:45, John Jannotti wrote:
> 
> > 
> > I don't know the exact problem, but the error output you show is probably
> > not from the shortened source that you show.  It is complaining about
> > identifiers (and line numbers) that don't exist in your source.  Perhaps
> > you shortened the source after generating the error?
> > 
> > Certainly the source you show compiles fine for me under g++.
> > 
> > shrub:~> cat hello.cc
> > #include <iostream.h>
> > int main()
> > {
> >         cout << "Hello, world!" << "\n";
> > }
> > shrub:~> g++ hello.cc
> > shrub:~> ./a.out 
> > Hello, world!
> > shrub:~> g++ -v
> > Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
> > gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)
> > 
> >   jj
> > 
> > 
> > "Jerry Feldman" <gerry.feldman at compaq.com> writes:
> > > I have a simple hello world program that uses the string class. This 
> > > compiles and runs ok on some commercial c++ compilers but not on g++ (2.95 
> > > and 3.03). This is just one sanitized issue with a larger system.
> > > #include <iostream.h>
> > > int main()
> > > {
> > >         cout << "Hello, world!" << "\n";
> > > }
> > > phbs.gf:src [158%] g++ hello.cc -o hello
> > > hello.cc: In function `int main()':
> > > hello.cc:5: `string' undeclared (first use this function)
> > > hello.cc:5: (Each undeclared identifier is reported only once for each 
> > > function it appears in.)
> > > hello.cc:5: parse error before `;' token
> > > hello.cc:6: `s' undeclared (first use this function)
> > > 
> > > phbs.gf:src [159%] cxx hello.cc -o hello
> > > phbs.gf:src [160%] hello
> > > Hello, world!
> > > 
> > > 
> > > --
> > > Jerry Feldman
> > > Portfolio Partner Engineering   
> > > 508-467-4315 http://www.testdrive.compaq.com/linux/
> > > 
> > > Compaq Computer Corp.
> > > 200 Forest Street MRO1-3/F1
> > > Marlboro, Ma. 01752
> > > 
> > > _______________________________________________
> > > Discuss mailing list
> > > Discuss at blu.org
> > > http://www.blu.org/mailman/listinfo/discuss
> 
> Jerry Feldman <gaf at blu.org>
> Associate Director
> Boston Linux and Unix user group
> http://www.blu.org PGP key id:C5061EA9
> PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
> 
> _______________________________________________
> Discuss mailing list
> Discuss at blu.org
> http://www.blu.org/mailman/listinfo/discuss
> 

-- 
-Paul Iadonisi
 Senior System Administrator
 Red Hat Certified Engineer / Local Linux Lobbyist
 Ever see a penguin fly?  --  Try Linux.
 GPL all the way: Sell services, don't lease secrets




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org