From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16506 invoked by alias); 24 May 2003 11:07:26 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 16486 invoked from network); 24 May 2003 11:07:25 -0000 Received: from unknown (HELO mail017.syd.optusnet.com.au) (210.49.20.175) by sources.redhat.com with SMTP; 24 May 2003 11:07:25 -0000 Received: from [192.168.0.101] (tooax7-231.dialup.optusnet.com.au [203.164.234.231]) by mail017.syd.optusnet.com.au (8.11.6p2/8.11.6) with ESMTP id h4OB7Mu20976 for ; Sat, 24 May 2003 21:07:23 +1000 Subject: RedHat 8.0 `istream_iterator' undeclared (first use this function) From: MR To: gcc-help@gcc.gnu.org In-Reply-To: <20030224045442.GA25932@uol.com.br> References: <20030224045442.GA25932@uol.com.br> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sat, 24 May 2003 11:07:00 -0000 Message-Id: <1053775198.2190.10.camel@nimrod> Mime-Version: 1.0 X-SW-Source: 2003-05/txt/msg00210.txt.bz2 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 #include #include 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(in1), istream_iterator(), istream_iterator(in2), istream_iterator(), ostream_iterator(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