Thread: iostream

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    7

    iostream

    Hey guys and girls,
    I've been normally using gcc and g++ in linux to compile my codes but recently I've had to temporarily switch over to a Windows machine. I downloaded Dev from bloodshed and it works beautifully on my c code. However, it's missing <iostream.h> which is nessisary to run c++ code. Or is it?
    If anyone could recoment an alternernate library or information on creating or downloading <iostream.h> I would be very appriciative.
    Thanks.
    -=Wynter=-

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Use:
    Code:
    #include <iostream>
    using namespace std;
    
    // Your code here
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Apr 2004
    Posts
    7
    Thanks for the speedy reply, Hammer. It worked perfectly.
    But why does
    Code:
    using namespace std;
    work? I know that namespace defines a class. So I guess we are 'using' the class called std.
    But how did that fix the problem? :-)
    -=Wynter=-

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    C++ now uses the new header files which do not have the .h ended. Some may have a c infront of them like cstring (not to be confused with the C++ string header file), cstdio, and cstdlib. These new header files have everything in the std namespace.

    A namespace is a grouping of classes, variables, functions, and other definitions. When we say we're using a namespace, we're bringing everything from that namespace into the global context so you dont have to type <namespace name>:: in front of everything.

  5. #5
    Registered User
    Join Date
    Apr 2004
    Posts
    7
    Okay, so the new "iostream" (without the 'h') is a class inside the std namespace and that code just tells the compiler, "Hey man, go find that". I get it now. And that would explain why I couldn't find a iostream.h file.
    Thanks people.
    -=Wynter=-

  6. #6
    Registered User
    Join Date
    Mar 2004
    Posts
    220
    Thats pretty much.

    One thing to note as well is that the headers without the '.h' extension are the standard headers, whereas headers _with_ the '.h' extension aren't the standard.

    The reason this is happening is because Dev C++ tries to follow the ISO standard alot =) Why it's good sometimes.
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

  7. #7
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    Dev C++ is just an IDE, not a compiler.

  8. #8
    Registered User
    Join Date
    Mar 2004
    Posts
    220
    >Dev C++ is just an IDE, not a compiler.
    Soo your saying that when I hit f9 it doesn't compile and run the program eh?
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

  9. #9
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Lightbulb Namespaces

    You can find more information about namespaces in the Programming FAQ. For most small homework-like programs, you can just go with 'using namespace std;' and be done with it. Other namespaces are only really useful when you have a big project with lots of custom header files, 3rd party libraries, and/or multiple programmers working on different parts of the program... Where there might be two different (global) functions with the same name. (Or, some other global variables/constants/structures/objects/etc., with the same name.)
    Dev C++ is just an IDE, not a compiler.
    How about "Dev-C++ is not just a compiler. It's a complete IDE."

    A IDE (Integrated Development Environment) isn't much of an IDE if it doesn't inlcude (at least) a compiler AND an editor!!!
    Last edited by DougDbug; 04-20-2004 at 05:37 PM.

  10. #10
    Registered User
    Join Date
    Mar 2004
    Posts
    220
    >How about "Dev-C++ is not just a compiler. It's a complete IDE."
    Ok that makes sense then I was about to say...
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

  11. #11
    Me -=SoKrA=-'s Avatar
    Join Date
    Oct 2002
    Location
    Europe
    Posts
    448
    >>How about "Dev-C++ is not just a compiler. It's a complete IDE."
    That's not true. Although an IDE is not much use if it doesn't come with a compiler, an IDE will just allow you to edit your code and will provide an easy access you your compiler functions.
    An IDE is one thing. A compiler is another.
    Dev-C++ uses (by default I think) the MingW port of gcc and g++, and you can download both separate or in a package, but being in a package doesn't mean it's the same thing.

    >>Soo your saying that when I hit f9 it doesn't compile and run the program eh?
    Dev-C++ doesn't. gcc/g++ will. Although it will run the pogram (or rather tell Windows to run it).

    >>A IDE (Integrated Development Environment) isn't much of an IDE if it doesn't inlcude (at least) a compiler AND an editor!
    An IDE will be an IDE even without a compiler. A good IDE should allow you to use any compiler you choose and configure it to do so properly, even if it comes bundled with a compiler.
    SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
    I say what I say, I mean what I mean.
    IDE: emacs + make + gcc and proud of it.

  12. #12
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Dev-C++ isn't a compiler, it's just and IDE, and you can configure it to use any compiler you want... I still call it a compiler anyway, because saying I use a MingW port of G++ takes too long and people don't know what I mean, and when I just say I'm using G++ people think I'm on a *nix box... it's just more convienient to call Dev-C++ a compiler...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Drieving from iostream
    By Thantos in forum C++ Programming
    Replies: 8
    Last Post: 06-23-2004, 04:57 PM
  2. iostream & hex?
    By dmlx90 in forum C++ Programming
    Replies: 0
    Last Post: 05-22-2002, 11:51 PM
  3. DJGPP Doesn't include IOSTREAM!!!!!!!!!!!
    By Frenchfry164 in forum Game Programming
    Replies: 12
    Last Post: 10-27-2001, 12:27 PM
  4. << in iostream
    By badman in forum C++ Programming
    Replies: 8
    Last Post: 10-18-2001, 10:19 PM
  5. Is there a C iostream?
    By Khisanth in forum C Programming
    Replies: 1
    Last Post: 09-05-2001, 12:34 AM