[comp.sys.next] Ok. So where are the C++ includes?

hobbs@cs.odu.edu (Andrew John Hobbs) (04/25/91)

Sorry if I'm ignorant on this subject.  I just got a book on C++ in obviously
mistaken impression that I can actually learn it.  So I get ready to type in
the good old HelloWorld program that uses the supposedly standard streams.hxx
class of objects.  Well and good.  CC++ can't find it.  I search and come
up with streams.h in the streams directory.  Cool.  Include that.  cout is 
not defined.   ARGH!!!

The simple code I'm working with is this:

// Hello.cxx : Saying Hello with C++

#include <streams.h>			// stream declarations

main() {
	cout << "Hello, World!  I am " << 5 << " Today!\n";
}


Even to me this seems relatively straightforward.  I've tried it on the Sun
SPARCs at school with the g++ compiler... WHERE ARE MY INCLUDES?  

This truely has to be the most frustrating part of learning a new language.
Am I going to have to go out and get the .hxx files from g++ or what?

hobbs@cs.odu.edu
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Well we know where we're going, but we don't know where we've been.
								- Talking Heads
One damn minute, Admiral.
								- Spock, STIV
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 

davisp@skybridge.SCL.CWRU.Edu (Palmer Davis) (04/25/91)

In article <HOBBS.91Apr24231419@hengest.cs.odu.edu> hobbs@cs.odu.edu (Andrew John Hobbs) writes:
>Sorry if I'm ignorant on this subject.  I just got a book on C++ in obviously
>mistaken impression that I can actually learn it.  So I get ready to type in
>the good old HelloWorld program that uses the supposedly standard streams.hxx
>class of objects.  Well and good.  CC++ can't find it.  I search and come
>up with streams.h in the streams directory.  Cool.  Include that.  cout is 
>not defined.   ARGH!!!
>

RTFM.

Specifically, get out your Digital Librarian and read in "2.0EntryPoint.rtf"
in the release notes, where it says "NeXT does not ship any C++ libraries
with Release 2.0."  It then goes on to mention libg++, which has a set of
stream routines in it.  The streams in stream.h are *not* iostreams in the
C++ sense, so it's not surprising that your C++ compiler barfed on them.

>
>Even to me this seems relatively straightforward.  I've tried it on the Sun
>SPARCs at school with the g++ compiler...
>

...and libg++.  Go get that, or better yet find a stream library that 
doesn't stick your code with the GPV.

-- PTD --
--
Palmer T. Davis                 |  davisp@scl.cwru.edu  -OR-  ptd2@po.cwru.edu
Case Western Reserve University | {att,sun,decvax,uunet}!cwjcc!skybridge!davisp
--------------------------------+----------------------------------------------
Just say no to interface fascism, software patents, and the GNU Public License.

tmab+@andrew.cmu.edu (Thomas Mok) (04/27/91)

Excerpts from netnews.comp.sys.next: 25-Apr-91 Ok. So where are the C++
i.. Andrew John Hobbs@cs.odu (1210)


> Sorry if I'm ignorant on this subject.  I just got a book on C++ in obviously
> mistaken impression that I can actually learn it.  So I get ready to type in
> the good old HelloWorld program that uses the supposedly standard streams.hxx
> class of objects.  Well and good.  CC++ can't find it.  I search and come
> up with streams.h in the streams directory.  Cool.  Include that.  cout is 
> not defined.   ARGH!!!


This was exactly how I felt when I tried to code my project in C++.

I then remember that I have previously downloaded some C++ source files
from the net.  They were made correctly on my machine, and I thought I might
be able to figure out how they were done.  Quite strangely, they seemed to have
avoided using cout completely.  Now is that the properly way to fix a problem?
The next step that I took was to go back to the good old printf statements.
The CC++ compiler gave me a warning for implicit declaration of printf. 
I thought
including stdio.h might help, but obviously stdio.h was not appropriate.
 I finally
gave up and went back to C.  I was frustrated.

Tom