iostream not visible in g++
Christian Convey
conveycj@npt.nuwc.navy.mil
Fri Jan 7 13:50:00 GMT 2005
Hi,
IIRC, some release of GCC moved objects like "cout" from the global namespace to
the std:: namespace.
So for code that use to look like this:
#include <iostream>
void foo() { cout << "Hello, World!" << endl;}
I now have the code look like this (by adding the 2nd line):
#include <iostream>
using namespace std;
void foo() { cout << "Hello, World!" << endl;}
Alternatively, if I didn't want to use the statement "using namespace std;", I
could instead write code as follows (by adding the "std::" prefix where necessary):
#include <iostream>
void foo() { std::cout << "Hello, World!" << std::endl;}
Hope this helps,
Christian
deepak prabhas soi wrote:
> Hi,
> I am running the gcc 3.4.2 . The .c files are
> compiling properly but when using g++ for compilation
> of c++ files,I can't compile even a single line file.
> Infact it gives problem in the inclusion of iostream.h
> file. what can be error. How can i make these standard
> libraries visible to program.I am getting the error as
>
>
> iostream: No such file or directory
> /hm/tmp.cpp: In function `int main()':
> /hm/tmp.cpp:17: error: `cout' undeclared (first use
> this function)
> /hm/tmp.cpp:17: error: (Each undeclared identifier is
> reported only once for each function it appears in.)
> /hm/tmp.cpp:17: error: `endl' undeclared (first use
> this function)
>
>
> Can anybody please help me, how can i make these
> standard libraries to be visible. I need it urgently.
>
> regards
> Prabhas
>
> =====
> If facts don't fit theory, change the facts
> -Albert Einstein
>
>
>
> __________________________________
> Do you Yahoo!?
> The all-new My Yahoo! - Get yours free!
> http://my.yahoo.com
>
>
--
Christian Convey
Computer Scientist,
Naval Undersea Warfare Center
Newport, RI
More information about the Gcc-help
mailing list