PDA

Click to See Complete Forum and Search --> : headerless C++


Chris_SE
Nov 13th, 2000, 10:39 AM
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

#include "c:\headerfolder\custom.h"

thats usual but will this work? I'm running unix dual on a Windows machine so...

#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]

parksie
Nov 13th, 2000, 02:33 PM
The reason iostream.h isn't there is because it's non-standard. Use iostream instead. You'd need to do this, though:

#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.

Chris_SE
Nov 13th, 2000, 04:18 PM
So using iostream instead of iostream.h will work in a Unix compiler? Btw I'm compiling with gcc if that matters

parksie
Nov 14th, 2000, 05:42 AM
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 ;)

Chris_SE
Nov 14th, 2000, 10:31 AM
Whats the main differences in using namespace std? I've only used it once for an array example from a book I saw

Chris_SE
Nov 14th, 2000, 10:39 AM
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.

parksie
Nov 14th, 2000, 01:51 PM
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 :(

Chris_SE
Nov 14th, 2000, 08:19 PM
It will be for windows, I just dont want to use VS, i prefer Borland

KENNNY
Nov 24th, 2000, 06:14 PM
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 :(