Results 1 to 9 of 9

Thread: headerless C++

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    Header Help!!

    I was wondering, I've been writing C++ in Unix lately and the problem is that the iostream.h header isn't built in(unlike borland or microsoft). Can I just define the header like it was a custom header I wrote? Like
    Code:
    #include "c:\headerfolder\custom.h"
    thats usual but will this work? I'm running unix dual on a Windows machine so...
    Code:
    #include "/dos/c++/.../iostream.h"
    Is that legal or is there another way to do it?

    [Edited by Chris_Se on 11-13-2000 at 01:23 PM]
    Chris

    [email protected]
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    The reason iostream.h isn't there is because it's non-standard. Use iostream instead. You'd need to do this, though:
    Code:
    #include <iostream>
    
    using namespace std; // Very important!
    
    void main() { ... }
    Make sure that you use the things from the "Standard C++ Library".

    NB: There may be a few slight syntax variations, but nothing too major.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    So Parksie

    So using iostream instead of iostream.h will work in a Unix compiler? Btw I'm compiling with gcc if that matters
    Chris

    [email protected]
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I used g++, but I think they're basically the same. I was able to get a few programs working quite well under both compilers with the same source, so that should be fine.

    PS: using namespace std; is about the biggest change
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    Whats the diff

    Whats the main differences in using namespace std? I've only used it once for an array example from a book I saw
    Chris

    [email protected]
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    Hmm, I'm on a roll

    While I'm on a roll here, could you direct me to a resource showing how to create objects(a GUI) using console C++? I don't like MFC because that would cause me to have to use VS.
    Chris

    [email protected]
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Do you mean a console GUI like the one on programs like DOS Edit? Or an actual Windows program, but done using the API?

    Either way, it will not be portable away from a PC
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    No

    It will be for windows, I just dont want to use VS, i prefer Borland
    Chris

    [email protected]
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

  9. #9
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355
    to create a windows gui without visual tools or MFC, use CreateWindowEx to create controls, etc. to change controls and get their props use SendMessage, etc, etc.
    its just a lot of boring code
    buzzwords are the language of fools

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width