public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Simple hello world problem
@ 2003-03-13 21:26 Kris Munch
  2003-03-13 22:43 ` Oscar Fuentes
  0 siblings, 1 reply; 3+ messages in thread
From: Kris Munch @ 2003-03-13 21:26 UTC (permalink / raw)
  To: gcc-help

New to MacOSX, and just installed the Mac Developer suite so I could 
use gcc. However, when creating the simple hello world program, I 
cannot get it to compile:

#include <iostream>
#include <stdio.h>

int main()
{
         cout << "TESTING.." << endl;
         return 0;
}


I get these errors:
myprog.cc: In function `int main()':
myprog.cc:6: `cout' undeclared (first use this function)
myprog.cc:6: (Each undeclared identifier is reported only once for each
    function it appears in.)
myprog.cc:6: `endl' undeclared (first use this function)


Like it doesn't know where the includes are, an cannot figure out what 
cout is. Can anyone help?

K. Munch

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Simple hello world problem
  2003-03-13 21:26 Simple hello world problem Kris Munch
@ 2003-03-13 22:43 ` Oscar Fuentes
  2003-03-14  9:04   ` LLeweLLyn Reese
  0 siblings, 1 reply; 3+ messages in thread
From: Oscar Fuentes @ 2003-03-13 22:43 UTC (permalink / raw)
  To: gcc-help

Kris Munch <munch@cs.umn.edu> writes:

> New to MacOSX, and just installed the Mac Developer suite so I could
> use gcc. However, when creating the simple hello world program, I
> cannot get it to compile:
> 
> #include <iostream>
> #include <stdio.h>
> 
> int main()
> {
>          cout << "TESTING.." << endl;
>          return 0;
> }
> 
> 
> I get these errors:
> myprog.cc: In function `int main()':
> myprog.cc:6: `cout' undeclared (first use this function)
> myprog.cc:6: (Each undeclared identifier is reported only once for each
>     function it appears in.)
> myprog.cc:6: `endl' undeclared (first use this function)
> 
> 
> Like it doesn't know where the includes are, an cannot figure out what
> cout is. Can anyone help?

This question is asked approx. 5 times per week. Standard C++ Library
names are on namespace std. So you need std::cout, std::vector,
std::endl, std::sort and so on.

-- 
Oscar

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Simple hello world problem
  2003-03-13 22:43 ` Oscar Fuentes
@ 2003-03-14  9:04   ` LLeweLLyn Reese
  0 siblings, 0 replies; 3+ messages in thread
From: LLeweLLyn Reese @ 2003-03-14  9:04 UTC (permalink / raw)
  To: Oscar Fuentes; +Cc: gcc-help

Oscar Fuentes <ofv@wanadoo.es> writes:

> Kris Munch <munch@cs.umn.edu> writes:
> 
> > New to MacOSX, and just installed the Mac Developer suite so I could
> > use gcc. However, when creating the simple hello world program, I
> > cannot get it to compile:
> > 
> > #include <iostream>
> > #include <stdio.h>
> > 
> > int main()
> > {
> >          cout << "TESTING.." << endl;
> >          return 0;
> > }
> > 
> > 
> > I get these errors:
> > myprog.cc: In function `int main()':
> > myprog.cc:6: `cout' undeclared (first use this function)
> > myprog.cc:6: (Each undeclared identifier is reported only once for each
> >     function it appears in.)
> > myprog.cc:6: `endl' undeclared (first use this function)
> > 
> > 
> > Like it doesn't know where the includes are, an cannot figure out what
> > cout is. Can anyone help?
> 
> This question is asked approx. 5 times per week. Standard C++ Library
> names are on namespace std. So you need std::cout, std::vector,
> std::endl, std::sort and so on.

Then perhaps somebody should should lobby for a feature such that if a
    name is not found during lookup, it should be looked up again in
    the std namespace, and if it is found in the std namespace, the
    message 'The name xxx has been moved to the std namespace, as per
    ISO C++ 1998. Use std::xxx, or an appropriate using declaration.'
    should be appended to the error message.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-14  1:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-13 21:26 Simple hello world problem Kris Munch
2003-03-13 22:43 ` Oscar Fuentes
2003-03-14  9:04   ` LLeweLLyn Reese

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).