471,582 Members | 1,686 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

#include<iostream> doesnt work in VC++ compiler

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.

Nov 27 '05 #1
9 6035

"nichas" <sa***********@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
I tried to use #include<iostream> in visual C++ compiler but then it
didnt work
Define "didnt work." It works for me just fine.
but i see this is the way it is being mentioned in C++
primer by lippman and lajoie..
That's because that's the valid name for that header.
where is the problem..


Probably that you aren't reading *everything* in your book.

I'll take a guess at what's causing your problem and
tell you to look up 'std' and 'namespace'.

-Mike
Nov 27 '05 #2

nichas wrote:
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.


try:

#include <iostream>

notice the space between #include and <iostream>

-- peter

Nov 27 '05 #3

"nichas" <sa***********@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
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.


The problem is on the line 42 of your code.
Learn how to post.
Nov 27 '05 #4

"peter steiner" <pn*******@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...

nichas wrote:
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.


try:

#include <iostream>

notice the space between #include and <iostream>


The space is not required (however I do use one because
I find it more readable).

-Mike
Nov 27 '05 #5
nichas wrote:
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.


Copy and past (DON'T RETYPE) the following program, then please report
back on what it tells you after you compile and execute it:

#include <iostream>

int main()
{
std::cout << "It turns out <iostream> works fine." << std::endl;
}

Best regards,

Tom

Nov 27 '05 #6
[snip]
#include <iostream>

int main()
{
std::cout << "It turns out <iostream> works fine." << std::endl;
}


almost ... std::endl is in <ostream>, but since standard headers may
include each other it may work sometimes (ok ok, it works on every
compiler i am aware of, but still ...)
Nov 27 '05 #7
nichas wrote:
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.


It does work. You're doing something wrong. Please post the code you say
doesn't work, say why you think it doesn't work, and specify which
version of Visual C++ you are using.

John
Nov 27 '05 #8
John Harrison wrote:

nichas wrote:
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.


It does work. You're doing something wrong. Please post the code you say
doesn't work, say why you think it doesn't work, and specify which
version of Visual C++ you are using.


and most important: tell us the error message from your compiler.
Usually the first 2 or 3 messages are sufficient.
--
Karl Heinz Buchegger
kb******@gascad.at
Nov 28 '05 #9
Thomas, it worked fine.. I think that the problem lies in me.. i did
complete a intermediate level course in C++ about 2years back and
things have faded away.. so i got to get through them and then only
post any doubts not leading to waste of ur time.. i will surely find
the difference in code given by you and the code which gave me the
error and i do appologize i should have provide the group with the code
and the error that emanated.. thanks again all of you and thomas you
too..

Nov 28 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by John Tiger | last post: by
1 post views Thread by ya man | last post: by
5 posts views Thread by wesley | last post: by
1 post views Thread by lars.uffmann | last post: by
1 post views Thread by Old Wolf | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Vinnie | last post: by
reply views Thread by lumer26 | last post: by

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.