This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: iostream.h problem
- From: "Itay 'z9u2K' Duvdevani" <z9u2k at bezeqint dot net>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 13 Jan 2003 22:09:51 +0200
- Subject: RE: iostream.h problem
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++
headers.
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.
}