CC fails where g++, g++-egcs succeeds (solaris 2.5.1)

CC fails where g++, g++-egcs succeeds (solaris 2.5.1)

Post by Toby Blak » Sat, 31 Jul 1999 04:00:00



Hi,

I am fairly inexperienced with C++ compilers under Unix (having tended
to do most of my programming using Visual C++) and I have what I hope is
a simple question.  I've just installed the latest Sun C++ compiler at
work (5.0).  However, this fails to compile a program which both g++
(2.8.1) and g++-egcs (2.91.66) will happily compile.

The program is:

#include <iterator>
#include <iostream>
#include <algorithm>

int main(int argc,char**argv) {
  copy(istream_iterator<char>(cin),istream_iterator<char>(),
       ostream_iterator<char>(cout));

Quote:}

...and it gives the following error:

brodie% CC-5.0 hello4.cc
"hello4.cc", line 7: Error: istream_iterator is not defined.
"hello4.cc", line 7: Error: Badly formed expression.
2 Error(s) detected.
brodie%

Can anyone shed any light on this?  Many thanks in advance.

Toby Blake
University of Edinburgh

 
 
 

CC fails where g++, g++-egcs succeeds (solaris 2.5.1)

Post by Bryan VanDeVe » Sat, 31 Jul 1999 04:00:00


I've already informed Sun of one implementation problem concerning
istream_iterator<> in CC5.0, which supposedly they are working on a
patch for.  It may just be a misconfiguration on the STL that ships with
SUNWspro.  In the mean time, I use egcs.

I would contact Sun about it.

Quote:> I am fairly inexperienced with C++ compilers under Unix (having tended
> to do most of my programming using Visual C++) and I have what I hope is
> a simple question.  I've just installed the latest Sun C++ compiler at
> work (5.0).  However, this fails to compile a program which both g++
> (2.8.1) and g++-egcs (2.91.66) will happily compile.

> The program is:

> #include <iterator>
> #include <iostream>
> #include <algorithm>

> int main(int argc,char**argv) {
>   copy(istream_iterator<char>(cin),istream_iterator<char>(),
>        ostream_iterator<char>(cout));
> }

> ...and it gives the following error:

> brodie% CC-5.0 hello4.cc
> "hello4.cc", line 7: Error: istream_iterator is not defined.
> "hello4.cc", line 7: Error: Badly formed expression.
> 2 Error(s) detected.
> brodie%

> Can anyone shed any light on this?  Many thanks in advance.

--
Bryan Van de Ven
Applied Research Labs
University of Texas, Austin

 
 
 

CC fails where g++, g++-egcs succeeds (solaris 2.5.1)

Post by lx » Sat, 31 Jul 1999 04:00:00



>brodie% CC-5.0 hello4.cc
>"hello4.cc", line 7: Error: istream_iterator is not defined.
>"hello4.cc", line 7: Error: Badly formed expression.
>2 Error(s) detected.
>brodie%
>Can anyone shed any light on this?  Many thanks in advance.

It was my impression that cc was a C compiler, not a C++ compiler. That
would seem to fit the errors you are receiving.

.lx
--

[ "in a mirror, all the time turns counter-clockwise." ]
[ "and every time i look, i find my face has changed." ]

 
 
 

CC fails where g++, g++-egcs succeeds (solaris 2.5.1)

Post by Rya » Sat, 31 Jul 1999 04:00:00




Quote:>Hi,

>I am fairly inexperienced with C++ compilers under Unix (having tended
>to do most of my programming using Visual C++) and I have what I hope is
>a simple question.  I've just installed the latest Sun C++ compiler at
>work (5.0).  However, this fails to compile a program which both g++
>(2.8.1) and g++-egcs (2.91.66) will happily compile.

>The program is:

>#include <iterator>
>#include <iostream>
>#include <algorithm>

>int main(int argc,char**argv) {
>  copy(istream_iterator<char>(cin),istream_iterator<char>(),
>       ostream_iterator<char>(cout));
>}

>...and it gives the following error:

>brodie% CC-5.0 hello4.cc
>"hello4.cc", line 7: Error: istream_iterator is not defined.
>"hello4.cc", line 7: Error: Badly formed expression.
>2 Error(s) detected.
>brodie%

Could it perhaps be that you need to specify the std namespace?  If CC
is a C++ compiler, I'd try using std::istream_iterator<char> instead.

======
Remove nospam information if you must reply via e-mail.


======

 
 
 

CC fails where g++, g++-egcs succeeds (solaris 2.5.1)

Post by Bryan VanDeVe » Sat, 31 Jul 1999 04:00:00


[snip]

Quote:> >brodie% CC-5.0 hello4.cc
> >"hello4.cc", line 7: Error: istream_iterator is not defined.
> >"hello4.cc", line 7: Error: Badly formed expression.
> >2 Error(s) detected.
> >brodie%

> Could it perhaps be that you need to specify the std namespace?  If CC
> is a C++ compiler, I'd try using std::istream_iterator<char> instead.

Yes, it does need std::istream_iterator (as well as std::cin and
std::cout) or a "using" directive.  But if you make those changes, you
then run into the bug that I informed Sun of about two months ago -
namely that operator==() for istream_iterators is completely broken and
will not compile.

And yes in SUNWspro, CC is the C++ compiler, and cc is the C compiler.

Regards,

--
Bryan Van de Ven
Applied Research Labs
University of Texas, Austin

 
 
 

CC fails where g++, g++-egcs succeeds (solaris 2.5.1)

Post by Steven M. Gal » Sat, 31 Jul 1999 04:00:00





>>brodie% CC-5.0 hello4.cc
>>"hello4.cc", line 7: Error: istream_iterator is not defined.
>>"hello4.cc", line 7: Error: Badly formed expression.
>>2 Error(s) detected.
>>brodie%
>>Can anyone shed any light on this?  Many thanks in advance.

>It was my impression that cc was a C compiler, not a C++ compiler. That
>would seem to fit the errors you are receiving.

cc is the C compiler, CC is the C++ compiler

Steve

 
 
 

1. Solaris x86 2.1 install succeeds but 2.4 fails

Solaris 2.1 installs fine on this hardware. But when using exactly the same
BIOS, chipset, and jumper settings, Solaris 2.4 installation fails.

Hardware Characteristics:
-------------------------
SOYO SY-025J2 VLB motherboard, with SIS chipset (85C407 and 85C471).
AWARD BIOS
INTEL 486DX2/66
1 72-pin SIMM of 16MB
ADAPTEC 1542B (port 330h, DMA channel 6, DMA speed 5MB/s, interrupt 11,
               BIOS enabled, synchronous negotiation disabled,
               SCSI terminators removed)
DISK : seagate ST31200N (1GB, scsi address 0, terminator enabled)
CDROM : external SUN drive model 411 (scsi address 6, external terminator)

I tried with various settings (L2 cache OFF/WRITE TROUGH/WRITE BACK, extra wait
states for L2 cache and for main memory, CPU clock 33MHZ/8MHZ).
All BIOS shadowing and green features are set OFF.
Memory and system board are successfully tested with 'checkit', and
the 1542 BIOS DMA-test reports no errors.

I get the following symptoms when installing Solaris 2.4:

After the SunOs Copyright message, the Solaris 2.4 installation gives a

  'WARNING: clock gained ...' message.

About 14 seconds later, messages appear on the screen.
The ones that aren't immediately scrolled off are:


      transport completed with incomplete

      SCSI transport failed: reason 'incomplete': retrying command
.. previous 4 lines repeated 3 times

      SCSI transport failed: reason 'incomplete': giving up

The CDROM light goes off, but the '\' character keeps tumbling in
the lower left corner of the screen.

Any hints to resolve this would be appreciated.

Thanks,


2. Using the mouse port as a kernal console (can it be done)?

3. rsh Not Succeeding Then Succeeding

4. g++ for solaris7 x86

5. cc,gcc,egcs, etc, etc....

6. FreeBSD 3.1 and XOpenDisplay problems while using the postgresql?

7. Precompiled cc, cc++, gcc for Solaris 2.4 x86

8. Kernel crash dump

9. help: cc/gcc/egcs broken

10. cc: Can't exec /usr/ccs/bin/ld (Solaris Express build 52)

11. what is difference between "gcc" and "egcs cc"?

12. Blocking connect() fails, non-blocking succeeds?

13. Telent succeeds, rlogin fails