www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/08/12/03:49:15

Date: Mon, 12 Aug 2002 10:13:48 +0300 (WET)
From: Andris Pavenis <pavenis AT lanet DOT lv>
X-Sender: pavenis AT ieva06
To: Alex Vinokur <alexvn AT bigfoot DOT com>
Cc: djgpp AT delorie DOT com
Subject: Re: istream_iterator, ostream_iterator and gcc/gpp-3.1
In-Reply-To: <aj2vjj$178ktl$1@ID-79865.news.dfncis.de>
Message-ID: <Pine.A41.4.05.10208121012530.4962-100000@ieva06>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com


On 10 Aug 2002, Alex Vinokur wrote:

> ============
> Windows 2000
> DJGPP 2.03
> gcc/gpp 3.1
> ============
> 
> 
> The code below has no problem with gcc/gpp 3.0.4.
> 
> However it does have a problem with gcc/gpp 3.1.
> 
> What has been changed concerning istream_iterator and ostream_iterator ?
> 
> ######### C++ code : BEGIN #########
> // File t1.cpp
> 
> #include <string>
> #include <vector>
> #include <sstream>
> #include <iostream>
> #include <fstream>


missing '#include <iterator>'
(I also have met this problem)

Andris



> using namespace std;
> 
> // ==============================
> int main (int argc, char** argv)
> {
> string file_line;
> 
>   if (!(argc > 1))
>   {
>     cout << "FATAL ERROR !"
>          << endl;
> 
>     cout << "   Usage : "
>          << argv[0]
>          << " "
>          << "<Data-File-Name>"
>          << endl;
>     return 1;
>   }
>   assert (argc > 1);
> 
>   ifstream fin (argv[1]);
>   assert (fin);
> 
> 
>   cout << endl;
>   cout << "\t-----------------------" << endl;
>   cout << "\t--- File " << argv[1] << endl;
>   cout << "\t-----------------------" << endl;
> 
>   for (int i = 1; getline (fin, file_line); i++)
>   {
>     vector<string> file_vline;
>     istringstream isstr (file_line.c_str ());
> 
>     copy(
>          istream_iterator<string>(isstr),
>          istream_iterator<string> (),
>          back_inserter (file_vline)
>         );
> 
>     cout << "\t  Line#" << i << " ---> ";
>     copy (
>           file_vline.begin (),
>           file_vline.end (),
>           ostream_iterator<string> (cout, " # ")
>          );
>     cout << endl;
> 
> 
>   } // while
> 
>   cout << "\t-----------------------" << endl;
> 
> }
> 
> 
> ######### C++ code : END ###########
> 
> 
> ######### Compilation : BEGIN #########
> 
> %gpp t1.cpp
> 
> T1.CPP: In function `int main(int, char**)':
> T1.CPP:43: `istream_iterator' undeclared (first use this function)
> T1.CPP:43: (Each undeclared identifier is reported only once for each function
>    it appears in.)
> T1.CPP:43: parse error before `>' token
> T1.CPP:52: `ostream_iterator' undeclared (first use this function)
> T1.CPP:52: parse error before `>' token
> 
> 
> ######### Compilation : END ###########



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019