tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* gcc 3.2.3 problem with includes
@ 2003-07-07 18:56 Darryl Cook
  2003-07-07 19:04 ` more info - " Darryl Cook
  2003-07-08 16:40 ` Summary: " Darryl Cook
  0 siblings, 2 replies; 3+ messages in thread
From: Darryl Cook @ 2003-07-07 18:56 UTC (permalink / raw)


Im having a problem with includes and gcc 3.1 and 3.2.3.  If I compile 
the following:

#include <iostream>
#include <string>

int main(void)
{
string card;

while (cin >> card)
{
   cout << "value = " << card[0] << endl;
   cout << "suit = " card[1] << endl;
 }
}

getcards.C: In function `int main()':
getcards.C:6: `string' undeclared (first use this function)
getcards.C:6: (Each undeclared identifier is reported only once for each
   function it appears in.)
getcards.C:6: parse error before `;' token
getcards.C:8: `cin' undeclared (first use this function)
getcards.C:8: `card' undeclared (first use this function)
getcards.C:10: `cout' undeclared (first use this function)
getcards.C:10: `endl' undeclared (first use this function)

cout is defined in the iostream.h file which is located at 
/usr/local/gcc/gcc-3.1/include/g++-v3/backward.

Any ideas why it dont find the declaration for cout?

thanks
darryl



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

* more info -  gcc 3.2.3 problem with includes
  2003-07-07 18:56 gcc 3.2.3 problem with includes Darryl Cook
@ 2003-07-07 19:04 ` Darryl Cook
  2003-07-08 16:40 ` Summary: " Darryl Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Darryl Cook @ 2003-07-07 19:04 UTC (permalink / raw)


Im running Tru64 5.1b and compiled gcc with
CC="cc" ../configure --prefix=/usr/local/gcc/gcc-3.1

Darryl Cook wrote:

> Im having a problem with includes and gcc 3.1 and 3.2.3.  If I compile 
> the following:
>
> #include <iostream>
> #include <string>
>
> int main(void)
> {
> string card;
>
> while (cin >> card)
> {
>   cout << "value = " << card[0] << endl;
>   cout << "suit = " card[1] << endl;
> }
> }
>
> getcards.C: In function `int main()':
> getcards.C:6: `string' undeclared (first use this function)
> getcards.C:6: (Each undeclared identifier is reported only once for each
>   function it appears in.)
> getcards.C:6: parse error before `;' token
> getcards.C:8: `cin' undeclared (first use this function)
> getcards.C:8: `card' undeclared (first use this function)
> getcards.C:10: `cout' undeclared (first use this function)
> getcards.C:10: `endl' undeclared (first use this function)
>
> cout is defined in the iostream.h file which is located at 
> /usr/local/gcc/gcc-3.1/include/g++-v3/backward.
>
> Any ideas why it dont find the declaration for cout?
>
> thanks
> darryl
>




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

* Summary: gcc 3.2.3 problem with includes
  2003-07-07 18:56 gcc 3.2.3 problem with includes Darryl Cook
  2003-07-07 19:04 ` more info - " Darryl Cook
@ 2003-07-08 16:40 ` Darryl Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Darryl Cook @ 2003-07-08 16:40 UTC (permalink / raw)


Thanks to Stan Horwitz, Steve Feehan and Pinghc for quick 
replies........seems to work if you put using namespace std;   right 
below the includes or you could set it each time like std::cout.  At any 
rate you have to tell it with 3.x versions which conforms more to 
standards that were adopted.  Also you need to set LD_LIBRARY_PATH 
environment variable to /gcc_installed_directory/lib.

thanks!
darryl cook


Darryl Cook wrote:

> Im having a problem with includes and gcc 3.1 and 3.2.3.  If I compile 
> the following:
>
> #include <iostream>
> #include <string>
>
> int main(void)
> {
> string card;
>
> while (cin >> card)
> {
>   cout << "value = " << card[0] << endl;
>   cout << "suit = " card[1] << endl;
> }
> }
>
> getcards.C: In function `int main()':
> getcards.C:6: `string' undeclared (first use this function)
> getcards.C:6: (Each undeclared identifier is reported only once for each
>   function it appears in.)
> getcards.C:6: parse error before `;' token
> getcards.C:8: `cin' undeclared (first use this function)
> getcards.C:8: `card' undeclared (first use this function)
> getcards.C:10: `cout' undeclared (first use this function)
> getcards.C:10: `endl' undeclared (first use this function)
>
> cout is defined in the iostream.h file which is located at 
> /usr/local/gcc/gcc-3.1/include/g++-v3/backward.
>
> Any ideas why it dont find the declaration for cout?
>
> thanks
> darryl
>




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

end of thread, other threads:[~2003-07-08 16:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-07 18:56 gcc 3.2.3 problem with includes Darryl Cook
2003-07-07 19:04 ` more info - " Darryl Cook
2003-07-08 16:40 ` Summary: " Darryl Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox