From: MR <nimrod.bm@optusnet.com.au>
To: gcc-help@gcc.gnu.org
Subject: RedHat 8.0 `istream_iterator' undeclared (first use this function)
Date: Sat, 24 May 2003 11:07:00 -0000 [thread overview]
Message-ID: <1053775198.2190.10.camel@nimrod> (raw)
In-Reply-To: <20030224045442.GA25932@uol.com.br>
Hello STL gurus,
I have a bit of a problem getting my iterators to work with libstdc++
3.2-7 (redhat 8.0), GCC 3.2.
with a very simple program (merges two files):
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
main(int argc, char**argv) {
if (argc < 3) {
cout << "You must supply two input files.\n";
exit(1);
}
ifstream in1(argv[1]), in2(argv[2]);
if(!in1||!in2) {
cout << "File open error\n";
exit(1);
}
merge(
istream_iterator<float>(in1),
istream_iterator<float>(),
istream_iterator<float>(in2),
istream_iterator<float>(),
ostream_iterator<float>(cout, "\n")
);
return 0;
}
I get the following complaints from the compiler:
algdemo.cpp:22: `istream_iterator' undeclared (first use this function)
algdemo.cpp:22: (Each undeclared identifier is reported only once for
each
function it appears in.)
algdemo.cpp:22: parse error before `>' token
I call the compile with g++ -g -Wall algdemo.cpp
So where am I going wrong? What do I need to do to get the
istream_iterators and ostream_iterators to work?
Thanks for your help, it is greatly appreciated.
Matt
next prev parent reply other threads:[~2003-05-24 11:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-24 5:07 Segmentation fault Causes Daniel Bolgheroni
2003-02-24 5:22 ` J.C.Wren
2003-04-22 1:02 ` Daniel Bolgheroni
2003-04-22 7:47 ` bjorn rohde jensen
2003-04-22 18:24 ` Dikandé Alain Moïse
2003-05-24 11:07 ` MR [this message]
2003-05-24 12:21 ` RedHat 8.0 `istream_iterator' undeclared (first use this function) Oscar Fuentes
2003-05-24 12:50 ` LLeweLLyn Reese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1053775198.2190.10.camel@nimrod \
--to=nimrod.bm@optusnet.com.au \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).