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

Discussion in 'C++' started by nichas, Nov 27, 2005.

  1. nichas

    nichas Guest

    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.
    nichas, Nov 27, 2005
    #1
    1. Advertising

  2. nichas

    Mike Wahler Guest

    "nichas" <> wrote in message
    news:...
    >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
    Mike Wahler, Nov 27, 2005
    #2
    1. Advertising

  3. 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
    peter steiner, Nov 27, 2005
    #3
  4. nichas

    Dan Cernat Guest

    "nichas" <> wrote in message
    news:...
    >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.
    Dan Cernat, Nov 27, 2005
    #4
  5. nichas

    Mike Wahler Guest

    "peter steiner" <> wrote in message
    news:...
    >
    > 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
    Mike Wahler, Nov 27, 2005
    #5
  6. 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
    Thomas Tutone, Nov 27, 2005
    #6
  7. nichas

    Kyle Guest

    [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 ...)
    Kyle, Nov 27, 2005
    #7
  8. 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
    John Harrison, Nov 27, 2005
    #8
  9. 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
    Karl Heinz Buchegger, Nov 28, 2005
    #9
  10. nichas

    nichas Guest

    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..
    nichas, Nov 28, 2005
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Tiger
    Replies:
    10
    Views:
    5,586
  2. ai@work
    Replies:
    9
    Views:
    541
    Ron Natalie
    Dec 16, 2004
  3. S. Nurbe

    iostream + iostream.h

    S. Nurbe, Jan 14, 2005, in forum: C++
    Replies:
    7
    Views:
    771
    red floyd
    Jan 15, 2005
  4. red floyd
    Replies:
    3
    Views:
    534
    Dietmar Kuehl
    Mar 8, 2005
  5. Replies:
    3
    Views:
    432
    alex23
    May 27, 2008
Loading...

Share This Page