public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* how can cout be undeclared?
@ 2002-02-08 11:50 Kirk
  2002-02-08 13:41 ` Frank Geck
  2002-02-08 14:14 ` Kayvan A. Sylvan
  0 siblings, 2 replies; 4+ messages in thread
From: Kirk @ 2002-02-08 11:50 UTC (permalink / raw)
  To: gcc-help

I'm trying to a program ported from linux (redhat7.2 running gcc-2.96RH) to 
freebsd. I have installed gcc-3.0. Most of the compile time errors that I was 
getting while using gcc-2.95 on freebsd have disappeared now that I'm 
compiling with gcc-30. However, there is one that is perplexing me. It is:

tveg.cpp: In member function `void TVeg::dayOut(TDay*)':
tveg.cpp:428: `cout' undeclared (first use this function)
tveg.cpp:428: (Each undeclared identifier is reported only once for each
   function it appears in.).... 

the whole error output is below. 

It is odd that a simple cout (which compiles fine on redhat's 2.96 version) 
is choking here.

Any thoughts?

Thanks in advance,

Kirk


su-2.05a$ make clean
rm *.o *~
su-2.05a$ make pnet
g++30 -c -ansi -g -Wall tday.cpp
g++30 -c -ansi -g -Wall tveg.cpp
tveg.cpp: In member function `void TVeg::dayOut(TDay*)':
tveg.cpp:428: `cout' undeclared (first use this function)
tveg.cpp:428: (Each undeclared identifier is reported only once for each
   function it appears in.)
tveg.cpp: In method `void TVeg::yearOutCN(TDay*)':
tveg.cpp:464: warning: unused variable `double folC'
tveg.cpp:465: warning: unused variable `double totalN'
tveg.cpp:466: warning: unused variable `double totalM'
tveg.cpp: In method `void TVeg::understory(TDay*)':
tveg.cpp:478: warning: unused variable `double mossResp'
tveg.cpp:481: warning: unused variable `double growthResp'
*** Error code 1

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

* Re: how can cout be undeclared?
  2002-02-08 11:50 how can cout be undeclared? Kirk
@ 2002-02-08 13:41 ` Frank Geck
  2002-02-08 14:14 ` Kayvan A. Sylvan
  1 sibling, 0 replies; 4+ messages in thread
From: Frank Geck @ 2002-02-08 13:41 UTC (permalink / raw)
  To: Kirk; +Cc: gcc-help

Kirk,
    I think (don't remember for sure) just add in you header or main "using
namespace std;".

Frank

Kirk wrote:

> I'm trying to a program ported from linux (redhat7.2 running gcc-2.96RH) to
> freebsd. I have installed gcc-3.0. Most of the compile time errors that I was
> getting while using gcc-2.95 on freebsd have disappeared now that I'm
> compiling with gcc-30. However, there is one that is perplexing me. It is:
>
> tveg.cpp: In member function `void TVeg::dayOut(TDay*)':
> tveg.cpp:428: `cout' undeclared (first use this function)
> tveg.cpp:428: (Each undeclared identifier is reported only once for each
>    function it appears in.)....
>
> the whole error output is below.
>
> It is odd that a simple cout (which compiles fine on redhat's 2.96 version)
> is choking here.
>
> Any thoughts?
>
> Thanks in advance,
>
> Kirk
>
> su-2.05a$ make clean
> rm *.o *~
> su-2.05a$ make pnet
> g++30 -c -ansi -g -Wall tday.cpp
> g++30 -c -ansi -g -Wall tveg.cpp
> tveg.cpp: In member function `void TVeg::dayOut(TDay*)':
> tveg.cpp:428: `cout' undeclared (first use this function)
> tveg.cpp:428: (Each undeclared identifier is reported only once for each
>    function it appears in.)
> tveg.cpp: In method `void TVeg::yearOutCN(TDay*)':
> tveg.cpp:464: warning: unused variable `double folC'
> tveg.cpp:465: warning: unused variable `double totalN'
> tveg.cpp:466: warning: unused variable `double totalM'
> tveg.cpp: In method `void TVeg::understory(TDay*)':
> tveg.cpp:478: warning: unused variable `double mossResp'
> tveg.cpp:481: warning: unused variable `double growthResp'
> *** Error code 1

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

* Re: how can cout be undeclared?
  2002-02-08 11:50 how can cout be undeclared? Kirk
  2002-02-08 13:41 ` Frank Geck
@ 2002-02-08 14:14 ` Kayvan A. Sylvan
  2002-02-08 16:12   ` gnu C++ compilation problem Kallol Biswas
  1 sibling, 1 reply; 4+ messages in thread
From: Kayvan A. Sylvan @ 2002-02-08 14:14 UTC (permalink / raw)
  To: Kirk; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]

On Fri, Feb 08, 2002 at 01:57:05PM -0600, Kirk wrote:
> I'm trying to a program ported from linux (redhat7.2 running gcc-2.96RH) to 
> freebsd. I have installed gcc-3.0. Most of the compile time errors that I was 
> getting while using gcc-2.95 on freebsd have disappeared now that I'm 
> compiling with gcc-30. However, there is one that is perplexing me. It is:
> 
> tveg.cpp: In member function `void TVeg::dayOut(TDay*)':
> tveg.cpp:428: `cout' undeclared (first use this function)
> tveg.cpp:428: (Each undeclared identifier is reported only once for each
>    function it appears in.).... 
> 
> the whole error output is below. 
> 
> It is odd that a simple cout (which compiles fine on redhat's 2.96 version) 
> is choking here.
> 
> Any thoughts?
> 
> Thanks in advance,
> 
> Kirk

This is correct behavior. gcc-2.X was not quite standard-conforming.

Add a "using std::cout;" statement and all should be well.

			---Kayvan
-- 
Kayvan A. Sylvan          | Proud husband of       | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

* gnu C++ compilation problem
  2002-02-08 14:14 ` Kayvan A. Sylvan
@ 2002-02-08 16:12   ` Kallol Biswas
  0 siblings, 0 replies; 4+ messages in thread
From: Kallol Biswas @ 2002-02-08 16:12 UTC (permalink / raw)
  To: gcc-help

#gcc -v
gcc version 2.95 19990728 (release)

The following .cpp file can't be compiled. Any
workaround is greatly appreciated.

-------------------ll.cpp----------------------

struct ip_opts
{
    int x;      
    char ip_opts[40];           /* Actually variable
in size.  */
};

main()
{

struct ip_opts tmp;

tmp.x=10;

}

The error message displayed is:

gcc /tmp/ll.cpp
/tmp/ll.cpp:4: ANSI C++ forbids data member `ip_opts'
with same name as enclosing class

__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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

end of thread, other threads:[~2002-02-09  0:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-08 11:50 how can cout be undeclared? Kirk
2002-02-08 13:41 ` Frank Geck
2002-02-08 14:14 ` Kayvan A. Sylvan
2002-02-08 16:12   ` gnu C++ compilation problem Kallol Biswas

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