473,804 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2428

"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++.
"Accelerate d 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 compilerspecifi c questions in the appropriate
NGs, e.g. microsoft.publi c.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++.
"Accelerate d 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 compilerspecifi c questions in the appropriate
NGs, e.g. microsoft.publi c.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++.
"Accelerate d 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 compilerspecifi c questions in the appropriate
NGs, e.g. microsoft.publi c.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.co m> 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

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

Similar topics

3
1969
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
7506
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 a bunch of "missing ;" errors. I did reinstall the whole thing a few times but it didn't work. Anyone have any idea? Thanks c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xutility(862) :
1
4575
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 <iostream.h> in some way examples to the error messages c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\streamb.h(90): error C2872: 'ios' : ambiguous symbo c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\streamb.h(90): error C2872:...
2
2168
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 are:
1
1362
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 the #include <iostream.h> into #include <iostream>. Because my project is very big, It's very difficult to change like that. Can anyone help me to use <iostream.h> in Visual Studio .NET ?
9
6178
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 reply please.
2
1778
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 Studio .NET\Vc7\include\useoldio.h(29) : warning C4995: '_OLD_IOSTREAMS_ARE_DEPRECATED': name was marked as #pragma deprecated Linking... LIBCMTD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main
8
3472
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
41284
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 World, I keep getting an error instead of it making the program. I've looked around the internet for a reason, but come up stuck. My only assumption would be that the fifth edition is upgraded to suit newer compilers? (I downloaded Visual C++...
0
9593
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7633
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.