* iostream.h problem
@ 2003-01-13 19:37 Anant Aneja
0 siblings, 0 replies; 2+ messages in thread
From: Anant Aneja @ 2003-01-13 19:37 UTC (permalink / raw)
To: gcc-help
thanks for solving my math.h problem but as i mentioned i have a
similar one with iostream.h.
I tried including the file directly by using "iostream.h" but the
problem does not seem to be with the inclusion
i get a undefined refrence to the cin operator
any otions u can suggest.
Also are ther any front ends for GCC that i can use ?
Anant Aneja
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: iostream.h problem
@ 2003-01-13 20:08 Itay 'z9u2K' Duvdevani
0 siblings, 0 replies; 2+ messages in thread
From: Itay 'z9u2K' Duvdevani @ 2003-01-13 20:08 UTC (permalink / raw)
To: gcc-help
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.
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-01-13 20:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-13 19:37 iostream.h problem Anant Aneja
2003-01-13 20:08 Itay 'z9u2K' Duvdevani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).