* RE: iostream not visible in g++
@ 2005-01-07 14:19 Martin York
0 siblings, 0 replies; 4+ messages in thread
From: Martin York @ 2005-01-07 14:19 UTC (permalink / raw)
To: deepak prabhas soi, gcc-help
Without the code its hard to say, but I bet its because all those
objects are in the standard namespace.
Try using std::cout std::endl etc.
Or adding a 'using' declaration in your source file.
NB Never put a 'using' declaration in a header file.
Martin
-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of deepak prabhas soi
Sent: 07 January 2005 06:18
To: gcc-help@gcc.gnu.org
Subject: iostream not visible in g++
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: iostream not visible in g++
2005-01-07 11:17 deepak prabhas soi
2005-01-07 12:37 ` Eljay Love-Jensen
@ 2005-01-07 13:50 ` Christian Convey
1 sibling, 0 replies; 4+ messages in thread
From: Christian Convey @ 2005-01-07 13:50 UTC (permalink / raw)
To: gcc-help
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: iostream not visible in g++
2005-01-07 11:17 deepak prabhas soi
@ 2005-01-07 12:37 ` Eljay Love-Jensen
2005-01-07 13:50 ` Christian Convey
1 sibling, 0 replies; 4+ messages in thread
From: Eljay Love-Jensen @ 2005-01-07 12:37 UTC (permalink / raw)
To: deepak prabhas soi, gcc-help
Hi Prabhas,
This worked for me:
#include <iostream>
int main()
{
std::cout << "Hello world" << std::endl;
}
What's your source code?
HTH,
--Eljay
^ permalink raw reply [flat|nested] 4+ messages in thread
* iostream not visible in g++
@ 2005-01-07 11:17 deepak prabhas soi
2005-01-07 12:37 ` Eljay Love-Jensen
2005-01-07 13:50 ` Christian Convey
0 siblings, 2 replies; 4+ messages in thread
From: deepak prabhas soi @ 2005-01-07 11:17 UTC (permalink / raw)
To: gcc-help
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-01-07 14:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-07 14:19 iostream not visible in g++ Martin York
-- strict thread matches above, loose matches on Subject: below --
2005-01-07 11:17 deepak prabhas soi
2005-01-07 12:37 ` Eljay Love-Jensen
2005-01-07 13:50 ` Christian Convey
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).