Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

C++ with linux---what's the equivalent to iostream.h?

562 views
Skip to first unread message

Julian Hill

unread,
Jul 9, 1996, 3:00:00 AM7/9/96
to

I am fairly new to c++ programming with dos and am wanting to learn
to use it under linux as well. i am using a book to learn c++ in
general and many of the examples refer to iostream.h and specifically
call the function "cout" to write to the console display. I can't
seem to find any such header file for gcc and was wondering if anyone
could tell me what the equivalent file is called and what is the
equivalent function...a very basic sample program would be:

#include <iostream.h>

Main()
{
cout << "This is a sample program";
return (0);
}

I am using slackware 3.0, kernel is 1.2.13 and gcc is 2.7.2 (?) i
think.

Thanks for any help,

Julian


Brandon Mitchell

unread,
Jul 9, 1996, 3:00:00 AM7/9/96
to

Look into fstream and stdio.h, I believe some combination is the standard
unix solution. Although cout is probably possible since my teacher
taught a dos class and graded on unix machines.

Hope this helps,
Brandon

-----
Brandon Mitchell
Homepage: http://www.geocities.com/SiliconValley/7877/home.html

John Kee

unread,
Jul 9, 1996, 3:00:00 AM7/9/96
to

You asked about the header files for C++ under a slackware 3.0 system,

There is a web page called Slackware 3.0 SimpleFixes maintained by
bar...@cuug.ab.ca,
http://www.cuug.ab.ca:8001/~barkers/slackware-fixes/

It has the following solution

Problem using g++

Submitted by: Gary Morton (ga...@bristol.st.com)

When trying to compile c++ programs using g++, the compiler issues error
messages about not being able to find '.h' standard include files (such as
iostream.h).

The g++ include files have been put in a directory of the wrong name for
the supplied version of the compiler. Documentation/man pages may also be
out of date, thus confusing matters. Go to the directory /usr/lib and
either 1) rename the directory g++-include to g++, or 2) setup a soft link

cd /usr/lib
ln -s g++-include g++

so that /usr/lib/g++ exists.

Additional info submitted by: Sam Trenholme (s...@netcom.com)

This also has to be done for /usr/include, i.e:

cd /usr/include
ln -s g++-include g++

I have not tried the above , I changed over to a RED HAT release as part
of a hardware upgrade.

Since C++ is meant to an ANSI standard your samples programs from the
book should work with G++ . Should generate an executable called a.out or
if you compile using the following

g++ hello.cc -o hello.exe
it should create an executable called hello.exe if all went well

Good Luck


"Research that predicts nothing but books will not suffice"
Kurt Levin.


Miquel van Smoorenburg

unread,
Jul 10, 1996, 3:00:00 AM7/10/96
to

In article <1996070908...@bambam.swlink.net>,

Julian Hill <lo...@swlink.net> wrote:
>I am fairly new to c++ programming with dos and am wanting to learn
>to use it under linux as well. i am using a book to learn c++ in
>general and many of the examples refer to iostream.h and specifically
>call the function "cout" to write to the console display. I can't
>seem to find any such header file for gcc and was wondering if anyone
>could tell me what the equivalent file is called and what is the
>equivalent function.
>
>I am using slackware 3.0, kernel is 1.2.13 and gcc is 2.7.2 (?) i
>think.

Well if you get recent libraries (libc 5.2.18 or 5.3.12) and the libg++-2.7.1
you will be all set. For me it was very easy to install because I use
Debian and packages for this stuff are readily available. I guess that
for Slackware you'll have to find a precompiled lib and header files some-
where and install by hand.

Mike.
--
+ Miquel van Smoorenburg + Cistron Internet Services + Living is a |
| miq...@cistron.nl (SP6) | Independent Dutch ISP | horizontal |
+ miq...@drinkel.ow.org + http://www.cistron.nl/ + fall +

Glen Flower

unread,
Jul 10, 1996, 3:00:00 AM7/10/96
to

On Tue, 9 Jul 1996, Brandon Mitchell wrote:

> Look into fstream and stdio.h, I believe some combination is the standard
> unix solution. Although cout is probably possible since my teacher
> taught a dos class and graded on unix machines.
>

> On Tue, 9 Jul 1996, Julian Hill wrote:
>
> > I am fairly new to c++ programming with dos and am wanting to learn
> > to use it under linux as well. i am using a book to learn c++ in
> > general and many of the examples refer to iostream.h and specifically
> > call the function "cout" to write to the console display. I can't

> > seem to find any such header file for gcc.

> > #include <iostream.h>
> >
> > Main()
> > {
> > cout << "This is a sample program";
> > return (0);
> > }
> >

> > I am using slackware 3.0, kernel is 1.2.13 and gcc is 2.7.2 (?) i
> > think

On Linux Slackware I have a "/usr/include/g++-include" directory which
includes, amongst other things an iostream.h, you would compile your
program using /usr/bin/g++.

Glen.


0 new messages