iostream.h problem

Itay 'z9u2K' Duvdevani
Mon Jan 13 20:08:00 GMT 2003

iostream (and all ios headers, etc.) are part of the C++ STL (Standart 
Template Library).
Trying to link against them using gcc will not work since these are C++ 
g++ seems to be handeling this quite easly though... :)

BTW, in the latest STL headers, iostream.h is not used anymore.
all STL classes are encapsulated into a namespace called std.

In order to use cin and cout etc. normally, do:

    // test.cpp:
    #include <iostream>
    using namespace std;    // invoke std into the global namespace

    // Compile/Link with g++, not gcc ! :]
    int main()
        cout << "Mary had a little lamb";

        // if you ommit line no. 2 (using namespace std), you could write:
        // std::cout << "Mary had a little lamb";
        // this will work just fine.

More information about the Gcc-help mailing list