G++ - Update

Derick Centeno yellowdog-general@lists.terrasoftsolutions.com
15 Sep 2004 16:28:58 -0400


Over a month ago an Todd complained about g++ and Jima responded to the
query as noted below.  

On Tue, 2004-08-10 at 08:24, Jima wrote:
> On Tue, 10 Aug 2004, Todd Luschen wrote:
> > Here's a newbie-ish question...where the heck did g++ go?  I had it in YDL 
> > 2.3, but now it's gone in YDL 3.0.  I tried reinstalling the gcc package, 
> > but to no avail.  Where's my GNU c++ compiler?!?!?
> 
> # rpm -qf `which g++`
> gcc-c++-3.2.2-2a
> 
>  :)
> 
>      Jima

But when I attempt to run g++, note that I have the version which Jima
referred to:

Installed package: gcc-c++.ppc 0:3.2.2-2a matches with
 gcc-c++

the following occurs:

[root@arakus aguilarojo]# g++ -Wall -o numbertest numbertest.C
In file included from /usr/include/c++/3.2.2/backward/iostream.h:31,
                 from numbertest.C:1:
/usr/include/c++/3.2.2/backward/backward_warning.h:32:2: warning:
#warning This file in
cludes at least one deprecated or antiquated header. Please consider
using one of the 3
2 headers found in section 17.4.1.2 of the C++ standard. Examples
include substituting
the <X> header for the <X.h> header for C++ includes, or <sstream>
instead of the depre
cated header <strstream.h>. To disable this warning use -Wno-deprecated.
numbertest.C: In function `int main()':
numbertest.C:7: no match for `std::istream& > int&' operator

The actual code in question is verbatim from a text discussing using g++
within the Linux environment!? .. I've commented out and included some
things which were recommended on other sites discussing this problem:

      1 //#include <iostream.h>
      2 //#include<istream>
      3 #include <iostream>
      4 using namespace std;
      5
      6 std::int main(void) {
      7         std::int input;
      8
      9         std::cout << "Enter a number: ";
     10         std::cin > input;
     11         std::cout << "Twice the number you supplied is " << 2 *
input << endl;
     12         return 0;
     13 }

There are still errors; I tried something more recognizeable:

      1 //#include <iostream.h>
      2 //#include<istream>
      3 #include <iostream>
      4 using namespace std;
      5
      6 int main(void) {
      7         std::int input;
      8
      9         cout << "Enter a number: ";
     10         cin > input;
     11         cout << "Twice the number you supplied is " << 2 * input
<< endl;
     12         return 0;
     13 }

System's response was:

[root@arakus aguilarojo]# g++ -Wall -o numbertest numbertest.C
numbertest.C: In function `int main()':
numbertest.C:7: parse error before `int'
numbertest.C:10: `input' undeclared (first use this function)
numbertest.C:10: (Each undeclared identifier is reported only once for
each
   function it appears in.)
[root@arakus aguilarojo]#

>From what I was able to gather the problem is the result of a dispute
between how Sun is interpreting C++ and how Linux programmers are
interpreting the same rules (section 17.4.1.2 of the C++ standard).  I'm
wondering if anyone has experienced this as well and what their solution
or work-around, besides avoiding c++ altogether, was or is.