473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

iostream.h with ms visual c++ 6.0?

Hello,

I want to use a tutorial to take first steps. I use MS Visual c++ 6.0 and
Win 98. When I try to compile a "hello world" program using the <iostream.h>
library and cout << "hello world", the compiler tells me that "cout" is an
undeclared identifier. But it does not tell me that including iostream.h
causes any problems. I read in a german newsgroup that instead of
<iostrem.h>, simply <iostrem> has to be included under MS Visual C++ and
that std::cout must be used. But when I try this, the compiler says
referring to #include <iostream>: "eh.h is only for C++". What should I do?

thank you very much in advance,

Moritz
Jul 22 '05 #1
12 2395

"Moritz Steinberger" <mo***************@yahoo.de> wrote in message
news:c1*************@news.t-online.com...
Hello,

I want to use a tutorial to take first steps. I use MS Visual c++ 6.0 and
Win 98. When I try to compile a "hello world" program using the <iostream.h> library and cout << "hello world", the compiler tells me that "cout" is an
undeclared identifier. But it does not tell me that including iostream.h
causes any problems. I read in a german newsgroup that instead of
<iostrem.h>, simply <iostrem> has to be included under MS Visual C++ and
that std::cout must be used. But when I try this, the compiler says
referring to #include <iostream>: "eh.h is only for C++". What should I

do?

If your source code file ends with .c it is compled as "C" code and not
"C++", use .cpp as the file extension to compile as "C++". Or configure VC
to work the way you prefere.

#include <iostream> is the proper C++ form. Also remember cout is in
namespace std. So you will need to std::cout.

Jeff F
Jul 22 '05 #2

"Moritz Steinberger" <mo***************@yahoo.de> wrote in message
news:c1*************@news.t-online.com...
Hello,

I want to use a tutorial to take first steps. I use MS Visual c++ 6.0 and
Win 98. When I try to compile a "hello world" program using the <iostream.h> library and cout << "hello world", the compiler tells me that "cout" is an
undeclared identifier. But it does not tell me that including iostream.h
causes any problems. I read in a german newsgroup that instead of
<iostrem.h>, simply <iostrem> has to be included under MS Visual C++ and
that std::cout must be used. But when I try this, the compiler says
referring to #include <iostream>: "eh.h is only for C++". What should I do?
thank you very much in advance,

Moritz


Make sure you're filename is called something.cpp. It sounds like you are
invoking the C compiler not the C++ compiler.

The advice about <iostream> or <iostream.h> is true of all compilers. Only
<iostream> is correct C++.

john
Jul 22 '05 #3
Moritz Steinberger wrote:

I want to use a tutorial to take first steps. I use MS Visual c++ 6.0 and
Win 98. When I try to compile a "hello world" program using the <iostream.h>
library and cout << "hello world", the compiler tells me that "cout" is an
undeclared identifier. But it does not tell me that including iostream.h
causes any problems. I read in a german newsgroup that instead of
<iostrem.h>, simply <iostrem> has to be included under MS Visual C++ and
iostream.h is an old header that should not be used anymore.
Please do as suggested in that newsgroup.

Also, you might want to get a good book to learn C++.
"Accelerated C++" is very recommended for starters.
that std::cout must be used. But when I try this, the compiler says
referring to #include <iostream>: "eh.h is only for C++". What should I do?


Your question is offtopic here, because you have problems
with a particular compiler, not the language itself.

Please ask compilerspecific questions in the appropriate
NGs, e.g. microsoft.public.de.vc (A german ng dedicated to VC++)
Nonetheless, your problem arises because you have named your
sourcefile .c the compiler thinks you want to program in C.

So simply rename your sourcefile to .cpp and it should work.

hth

Christoph
Jul 22 '05 #4
Hello,
Please do as suggested in that newsgroup.
I did as Mr. Harrison and Mr. Flinn told me here and it works fine now.
Thank you, Mr. Rabel, Mr. Harrison and Mr. Flinn.
Also, you might want to get a good book to learn C++.
"Accelerated C++" is very recommended for starters.
Well I checked several books, one even called "C++ for dummies", but I seem
to be even too dummy-like for the latter. Then I found a tutorial on www.
cplusplus.com which I would like to recommend to anyone who is an absolute
beginner or who knows such people and wants to give them some advice.
Your question is offtopic here, because you have problems
with a particular compiler, not the language itself.
I'm sorry for that, I just didn't realize the differences between C, C++ and
the Microsoft Visual C++ compiler.
Please ask compilerspecific questions in the appropriate
NGs, e.g. microsoft.public.de.vc (A german ng dedicated to VC++)


I'll do so in the future, thank you.

Moritz
Jul 22 '05 #5
KTC
"Moritz Steinberger" <mo***************@yahoo.de> for some reason
wrote:

Well I checked several books, one even called "C++ for dummies",
but I seem to be even too dummy-like for the latter. Then I
found a tutorial on www.cplusplus.com which I would like to
recommend to anyone who is an absolute beginner or who knows
such people and wants to give them some advice.


DON'T try to learn C++ from "C++ for dummies", it would do you more
harm than good (if it does you any good at all...).

The tutorial down at cplusplus.com is quite good EXCEPT for the fact
that it doesn't use the correct header name of <iostream> and instead
use <iostream.h> which as have already been said is wrong.

The only tutorial I can find on the internet that even use the
correct header is http://cplus.about.com/library/blcplustut.htm . It
seems quite good to me although some good books is still recommanded
as the way to learn.

Take a look at http://www.accu.org/bookreviews/public/index.htm for
some books review.
KTC

--
Experience is a good school but the fees are high.
- Heinrich Heine
Jul 22 '05 #6
> Your question is offtopic here, because you have problems
with a particular compiler, not the language itself.
I'm trying to figure out why this question is off topic here?

1) The extensionless headers is (in my opinion) a very poor decision on the
standards committee. Originally, before standardized, the headers *DID* have a
..h extension, and library implementors based their headers on that fact. Then,
the committee later changed to extensionless (if I recall correctly, it was
originally a mistake/unintended omission, but no one on the committee made
enough of a fuss about it, so it just stayed).

Other than Apple operating systems, I'm not aware of any os that doesn't use an
extensions to identify file types, although I'll be first to admit that my os
experience is primarily limited to the os that is found on 90% of desktop
systems.

The extension/extensionless issue is something that isn't compiler specific,
but is negative fallout of the slow standardization process that plagued C++
during the 90s.

2) All C++ compilers I've ever used (maybe 5), have defaulted to compiling C
code for .c files and C++ for .cpp files. Again, I don't think that this issue
is compiler-specific in any way.

Christoph Rabel wrote:
Moritz Steinberger wrote:

I want to use a tutorial to take first steps. I use MS Visual c++ 6.0 and
Win 98. When I try to compile a "hello world" program using the <iostream.h>
library and cout << "hello world", the compiler tells me that "cout" is an
undeclared identifier. But it does not tell me that including iostream.h
causes any problems. I read in a german newsgroup that instead of
<iostrem.h>, simply <iostrem> has to be included under MS Visual C++ and


iostream.h is an old header that should not be used anymore.
Please do as suggested in that newsgroup.

Also, you might want to get a good book to learn C++.
"Accelerated C++" is very recommended for starters.
that std::cout must be used. But when I try this, the compiler says
referring to #include <iostream>: "eh.h is only for C++". What should I do?


Your question is offtopic here, because you have problems
with a particular compiler, not the language itself.

Please ask compilerspecific questions in the appropriate
NGs, e.g. microsoft.public.de.vc (A german ng dedicated to VC++)

Nonetheless, your problem arises because you have named your
sourcefile .c the compiler thinks you want to program in C.

So simply rename your sourcefile to .cpp and it should work.

hth

Christoph

Jul 22 '05 #7
>
1) The extensionless headers is (in my opinion) a very poor decision on the standards committee. Originally, before standardized, the headers *DID* have a .h extension, and library implementors based their headers on that fact. Then, the committee later changed to extensionless (if I recall correctly, it was originally a mistake/unintended omission, but no one on the committee made
enough of a fuss about it, so it just stayed).


Really, where do you recall this from? I'm not doubting you, just interested
in your source of information.

john
Jul 22 '05 #8
> Really, where do you recall this from? I'm not doubting you, just interested
in your source of information.
Feel free to doubt -- I'm going from memory on this one from about 8 years ago,
and I can barely remember my name day to day...

I can't remember where I heard it -- I just know at the time that I first heard
about extensionless headers, I thought it was a bad idea and tried to find out
the motivation. I just did a quick search on Google and couldn't turn up
anything. Perhaps someone that remembers better than I can either confirm/deny
my thought on the subject...

John Harrison wrote:

1) The extensionless headers is (in my opinion) a very poor decision on

the
standards committee. Originally, before standardized, the headers *DID*

have a
.h extension, and library implementors based their headers on that fact.

Then,
the committee later changed to extensionless (if I recall correctly, it

was
originally a mistake/unintended omission, but no one on the committee made
enough of a fuss about it, so it just stayed).


Really, where do you recall this from? I'm not doubting you, just interested
in your source of information.

john

Jul 22 '05 #9
"Julie" <ju***@aol.com> wrote in message news:40***************@aol.com...
Your question is offtopic here, because you have problems
with a particular compiler, not the language itself.
I'm trying to figure out why this question is off topic here?

1) The extensionless headers is (in my opinion) a very poor decision on

the standards committee. Originally, before standardized, the headers *DID* have a .h extension, and library implementors based their headers on that fact. Then, the committee later changed to extensionless (if I recall correctly, it was originally a mistake/unintended omission, but no one on the committee made
enough of a fuss about it, so it just stayed).
Hardly. It was a concerted decision by the Library Subgroup that I opposed
vehemently. It certainly didn't happen by accident. I don't much care for
it to this day, but it's what the committee decided on, so it's Standard
C++ now.
Other than Apple operating systems, I'm not aware of any os that doesn't use an extensions to identify file types, although I'll be first to admit that my os experience is primarily limited to the os that is found on 90% of desktop
systems.

The extension/extensionless issue is something that isn't compiler specific, but is negative fallout of the slow standardization process that plagued C++ during the 90s.
I don't see how the slowness of the process caused this particular decision.
It's not like the extensions withered on the vine...
2) All C++ compilers I've ever used (maybe 5), have defaulted to compiling C code for .c files and C++ for .cpp files. Again, I don't think that this issue is compiler-specific in any way.


I believe the Topic Police leapt at the chance to decree iostream.h Off
Topic (TM) because there's no mention of that header in the C++ Standard.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
Jul 22 '05 #10

"Julie" <ju***@aol.com> wrote in message news:40***************@aol.com...
Really, where do you recall this from? I'm not doubting you, just interested
in your source of information.
Feel free to doubt -- I'm going from memory on this one from about 8 years

ago, and I can barely remember my name day to day...

I can't remember where I heard it -- I just know at the time that I first heard about extensionless headers, I thought it was a bad idea and tried to find out
the motivation. I just did a quick search on Google and couldn't turn up
anything. Perhaps someone that remembers better than I can either confirm/deny my thought on the subject...


I can't recall anything to that effect. All I remember is that Mr. Andrew Koenig
proposed
the idea of extensionless headers to the committee.
Jul 22 '05 #11
I'll gladly stand corrected, as I've said, I'm going from 8 year old memory on
this one.

The headers were originally .h, right? and then were subsequently changed (all
prior to standardization).

"P.J. Plauger" wrote:

"Julie" <ju***@aol.com> wrote in message news:40***************@aol.com...
Your question is offtopic here, because you have problems
with a particular compiler, not the language itself.


I'm trying to figure out why this question is off topic here?

1) The extensionless headers is (in my opinion) a very poor decision on

the
standards committee. Originally, before standardized, the headers *DID*

have a
.h extension, and library implementors based their headers on that fact.

Then,
the committee later changed to extensionless (if I recall correctly, it

was
originally a mistake/unintended omission, but no one on the committee made
enough of a fuss about it, so it just stayed).


Hardly. It was a concerted decision by the Library Subgroup that I opposed
vehemently. It certainly didn't happen by accident. I don't much care for
it to this day, but it's what the committee decided on, so it's Standard
C++ now.
Other than Apple operating systems, I'm not aware of any os that doesn't

use an
extensions to identify file types, although I'll be first to admit that my

os
experience is primarily limited to the os that is found on 90% of desktop
systems.

The extension/extensionless issue is something that isn't compiler

specific,
but is negative fallout of the slow standardization process that plagued

C++
during the 90s.


I don't see how the slowness of the process caused this particular decision.
It's not like the extensions withered on the vine...
2) All C++ compilers I've ever used (maybe 5), have defaulted to compiling

C
code for .c files and C++ for .cpp files. Again, I don't think that this

issue
is compiler-specific in any way.


I believe the Topic Police leapt at the chance to decree iostream.h Off
Topic (TM) because there's no mention of that header in the C++ Standard.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com

Jul 22 '05 #12
"Julie" <ju***@aol.com> wrote in message news:40***************@aol.com...
I'll gladly stand corrected, as I've said, I'm going from 8 year old memory on this one.

The headers were originally .h, right? and then were subsequently changed (all prior to standardization).


Yes, there was certainly an iostream.h. The argument during standardization
was that some people used *.h, some *.hpp, and some even other suffixes for
C++ headers. So the "compromise" was to render all of them nonconforming
by having no suffix at all.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
Jul 22 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: paulm | last post by:
there is no iostream.h in vs.net 2003 includes using iostream.h from vc6 header fails to link (limcimtd not found) So how do I compile code with old iostream header in it
1
by: Minh | last post by:
I've just installed VS.NET 2003 on my Athlon XP 1800+. However I couldn't get any project with STL includes to compile even if I create a new empty project (and added #include <string>). It gave me...
1
by: ya man | last post by:
when i use #include <iostream.h> in some files i get lots of error messages of the kind 'ambiguous symbol this is solved when i use #include <iostream why is that ? and can i use #include...
2
by: Brett | last post by:
Hi, I'm compiling an old project under the 'new' visual studio 7.1.3088. I changed the line: #include <iostream.h> to #include <iostream> and now I get a stack of errors, some of which...
1
by: Ly Hoang Hai | last post by:
Hi all, I have just port my C++ 6.0 project into C++ project of Visual Studio.NET. However, .NET tell me that it can not find iostream.h. Some search on the internet tell me that I should change...
9
by: nichas | last post by:
I tried to use #include<iostream> in visual C++ compiler but then it didnt work but i see this is the way it is being mentioned in C++ primer by lippman and lajoie.. where is the problem.. Do...
2
by: Chris Jones | last post by:
I am using the old <iostream.h>. When I compile a simple test program that uses <iostream.h>, Visual C++ 7 gives me this strange error: Compiling... capp.cpp C:\Program Files\Microsoft Visual...
8
by: jean.daniel.michaud | last post by:
Hi all, Something I don't get. The code is: // snippet on #include <list> #include <iostream> int main()
11
by: gumboots | last post by:
Hi there guys, I've recently purchased "Sam's Teach Yourself C++ Fifth Edition" (About a week before the 6th edition came out) I'm trying to work through the book, but in trying to compile Hello...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.