public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Which header should I include for "reverse"
@ 2004-08-30 11:17 learning c++
  2004-08-30 12:08 ` Arno Wilhelm
  0 siblings, 1 reply; 2+ messages in thread
From: learning c++ @ 2004-08-30 11:17 UTC (permalink / raw)
  To: gcc-help

Hi, Everyone:

I compiled a short program to use "reverse" like this:

#include <iostream>
#include <algorithm>

int main() {

double A[6] = { 1.2, 1.3, 1.4, 1.5, 1.6, 1.7 };
reverse(A, A + 6);
for (int i = 0; i < 6; ++i)
std::cout << "A[" << i << "] = " << A[i];
return 0;
}

But the error is:
reverse.cpp: In function `int main()':
reverse.cpp:7: error: `reverse' undeclared (first use this function)
reverse.cpp:7: error: (Each undeclared identifier is reported only once for
   each function it appears in.)

Thanks in advance!

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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

* Re: Which header should I include for "reverse"
  2004-08-30 11:17 Which header should I include for "reverse" learning c++
@ 2004-08-30 12:08 ` Arno Wilhelm
  0 siblings, 0 replies; 2+ messages in thread
From: Arno Wilhelm @ 2004-08-30 12:08 UTC (permalink / raw)
  To: learning c++; +Cc: gcc-help

Have not tried it out but maybe "using namespace std;" or
"std::reverse" would help ?



regards,

Arno


On Mon, 2004-08-30 at 11:43, learning c++ wrote:
> Hi, Everyone:
> 
> I compiled a short program to use "reverse" like this:
> 
> #include <iostream>
> #include <algorithm>
> 
> int main() {
> 
> double A[6] = { 1.2, 1.3, 1.4, 1.5, 1.6, 1.7 };
> reverse(A, A + 6);
> for (int i = 0; i < 6; ++i)
> std::cout << "A[" << i << "] = " << A[i];
> return 0;
> }
> 
> But the error is:
> reverse.cpp: In function `int main()':
> reverse.cpp:7: error: `reverse' undeclared (first use this function)
> reverse.cpp:7: error: (Each undeclared identifier is reported only once for
>    each function it appears in.)
> 
> Thanks in advance!
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*. 
> http://join.msn.com/?page=features/featuredemail
-- 
Arno Wilhelm <arno.wilhelm@profile.co.at>
proFILE Computersysteme GmbH

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

end of thread, other threads:[~2004-08-30 10:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-30 11:17 Which header should I include for "reverse" learning c++
2004-08-30 12:08 ` Arno Wilhelm

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