Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > no matching function for call to 'std::istream_iterator

Reply
Thread Tools

no matching function for call to 'std::istream_iterator

 
 
eric
Guest
Posts: n/a
 
      06-23-2011
Dear advance C++ programers:

I copy book (C++ Primer 3rd chapter 17 book example text_query.C )
can be download from
http://comscigate.com/BookCode/cppbooks.htm
but my g++ 4.5.2 cann't compile it
this is the error I got
---------------------------------------------------------------------
eric@eric-laptop:~/CppPrimer3/download/chap17$ g++ Query.C UserQuery.C
TextQuery.C text_query.C
TextQuery.C: In member function ‘void TextQuery::build_word_map()’:
TextQuery.C:229:67: error: no matching function for call to
‘std::istream_iterator<std::basic_string<char>,
int>::istream_iterator(std::ifstream&)’
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/bits/stream_iterator.h:70:7: note: candidates are:
std::istream_iterator<_Tp, _CharT, _Traits,
_Dist>::istream_iterator(const std::istream_iterator<_Tp, _CharT,
_Traits, _Dist>&) [with _Tp = std::basic_string<char>, _CharT = int,
_Traits = std::char_traits<int>, _Dist = int,
std::istream_iterator<_Tp, _CharT, _Traits, _Dist> =
std::istream_iterator<std::basic_string<char>, int>]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/bits/stream_iterator.h:66:7: note:
std::istream_iterator<_Tp, _CharT, _Traits,
_Dist>::istream_iterator(std::istream_iterator<_Tp , _CharT, _Traits,
_Dist>::istream_type&) [with _Tp = std::basic_string<char>, _CharT =
int, _Traits = std::char_traits<int>, _Dist = int,
std::istream_iterator<_Tp, _CharT, _Traits, _Dist>::istream_type =
std::basic_istream<int, std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/bits/stream_iterator.h:62:7: note:
std::istream_iterator<_Tp, _CharT, _Traits, _Dist>::istream_iterator()
[with _Tp = std::basic_string<char>, _CharT = int, _Traits =
std::char_traits<int>, _Dist = int]
In file included from /usr/local/lib/gcc/i686-pc-linux-gnu/
4.5.2/../../../../include/c++/4.5.2/iterator:67:0,
from TextQuery.C:2:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/bits/stream_iterator.h: In member function ‘void
std::istream_iterator<_Tp, _CharT, _Traits, _Dist>::_M_read() [with
_Tp = std::basic_string<char>, _CharT = int, _Traits =
std::char_traits<int>, _Dist = int]’:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/bits/stream_iterator.h:93:2: instantiated from
‘std::istream_iterator<_Tp, _CharT, _Traits, _Dist>&
std::istream_iterator<_Tp, _CharT, _Traits, _Dist>:perator++() [with
_Tp = std::basic_string<char>, _CharT = int, _Traits =
std::char_traits<int>, _Dist = int, std::istream_iterator<_Tp, _CharT,
_Traits, _Dist> = std::istream_iterator<std::basic_string<char>,
int>]’
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/bits/stl_algobase.h:318:4: instantiated from ‘static _OI
std::__copy_move<<anonymous>, <anonymous>, <template-parameter-1-3>
>::__copy_m(_II, _II, _OI) [with _II =

std::istream_iterator<std::basic_string<char>, int>, _OI =
std::insert_iterator<std::set<std::basic_string<ch ar>,
std::less<std::basic_string<char> >, std::allocator<short int> > >,
bool <anonymous> = false, bool <anonymous> = false, <template-
parameter-1-3> = std::input_iterator_tag]’
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/bits/stl_algobase.h:404:70: instantiated from ‘_OI
std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false, _II =
std::istream_iterator<std::basic_string<char>, int>, _OI =
std::insert_iterator<std::set<std::basic_string<ch ar>,
std::less<std::basic_string<char> >, std::allocator<short int> > >]’
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/bits/stl_algobase.h:442:39: instantiated from ‘_OI
std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false, _II =
std::istream_iterator<std::basic_string<char>, int>, _OI =
std::insert_iterator<std::set<std::basic_string<ch ar>,
std::less<std::basic_string<char> >, std::allocator<short int> > >]’
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/bits/stl_algobase.h:474:18: instantiated from ‘_OI
std::copy(_II, _II, _OI) [with _II =
std::istream_iterator<std::basic_string<char>, int>, _OI =
std::insert_iterator<std::set<std::basic_string<ch ar>,
std::less<std::basic_string<char> >, std::allocator<short int> > >]’
TextQuery.C:231:65: instantiated from here
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/bits/stream_iterator.h:119:6: error: no match for ‘operator>>’
in ‘*((std::istream_iterator<std::basic_string<char>, int>*)this)-
>std::istream_iterator<std::basic_string<char>, int>::_M_stream >>

((std::istream_iterator<std::basic_string<char>, int>*)this)-
>std::istream_iterator<std::basic_string<char>, int>::_M_value’

/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:120:7: note: candidates are: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(std::basic_istream<_CharT,
_Traits>::__istream_type& (*)(std::basic_istream<_CharT,
_Traits>::__istream_type&)) [with _CharT = int, _Traits =
std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:124:7: note: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(std::basic_istream<_CharT, _Traits>::__ios_type&
(*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT =
int, _Traits = std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >, std::basic_istream<_CharT,
_Traits>::__ios_type = std::basic_ios<int, std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:131:7: note: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT
= int, _Traits = std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:167:7: note: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(bool&) [with _CharT = int, _Traits =
std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/bits/istream.tcc:113:5: note:
std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
_Traits>:perator>>(short int&) [with _CharT = int, _Traits =
std::char_traits<int>]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:174:7: note: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(short unsigned int&) [with _CharT = int, _Traits
= std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/bits/istream.tcc:158:5: note:
std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
_Traits>:perator>>(int&) [with _CharT = int, _Traits =
std::char_traits<int>]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:181:7: note: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(unsigned int&) [with _CharT = int, _Traits =
std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:185:7: note: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(long int&) [with _CharT = int, _Traits =
std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:189:7: note: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(long unsigned int&) [with _CharT = int, _Traits =
std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:194:7: note: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(long long int&) [with _CharT = int, _Traits =
std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:198:7: note: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(long long unsigned int&) [with _CharT = int,
_Traits = std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:203:7: note: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(float&) [with _CharT = int, _Traits =
std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:207:7: note: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(double&) [with _CharT = int, _Traits =
std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:211:7: note: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(long double&) [with _CharT = int, _Traits =
std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/istream:215:7: note: std::basic_istream<_CharT,
_Traits>::__istream_type& std::basic_istream<_CharT,
_Traits>:perator>>(void*&) [with _CharT = int, _Traits =
std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<int,
std::char_traits<int> >]
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c++/
4.5.2/bits/istream.tcc:203:5: note:
std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
_Traits>:perator>>(std::basic_istream<_CharT,
_Traits>::__streambuf_type*) [with _CharT = int, _Traits =
std::char_traits<int>, std::basic_istream<_CharT,
_Traits>::__streambuf_type = std::basic_streambuf<int,
std::char_traits<int> >]
eric@eric-laptop:~/CppPrimer3/download/chap17$
------------------------------------------------------------------------------------------------------------------------------------------
that code I guess worked on some other compiler(probably Borland)
looking any g++ experienced c++ programer's help and thanks a lot in
advance
/* Dear Axel, I already follow your suggestion to eliminate the 3rd
parameter of template stack, it improve
a lot. */
Eric
 
Reply With Quote
 
 
 
 
Michael DOUBEZ
Guest
Posts: n/a
 
      06-23-2011
On 23 juin, 11:30, eric <(E-Mail Removed)> wrote:
> * I copy book (C++ Primer 3rd chapter 17 book example text_query.C )
> can be download fromhttp://comscigate.com/BookCode/cppbooks.htm
> but my g++ 4.5.2 cann't compile it
> this is the error I got
> ---------------------------------------------------------------------
> eric@eric-laptop:~/CppPrimer3/download/chap17$ g++ Query.C UserQuery.C
> TextQuery.C text_query.C
> TextQuery.C: In member function ‘void TextQuery::build_word_map()’:
> TextQuery.C:229:67: error: no matching function for call to
> ‘std::istream_iterator<std::basic_string<char>,
> int>::istream_iterator(std::ifstream&)’

[snip]
> that code I guess worked on some other compiler(probably Borland)
> looking any g++ experienced c++ programer's help and thanks a lot in
> advance
> /* Dear Axel, I already follow your suggestion to eliminate the 3rd
> parameter of template stack, it improve
> * *a lot. */


As a guess, I would say he didn't include the iterator header.
Add the following line at the beginning of TextQuery.C
#include <iterator>

--
Michael
 
Reply With Quote
 
 
 
 
red floyd
Guest
Posts: n/a
 
      06-23-2011
On Jun 23, 2:30*am, eric <(E-Mail Removed)> wrote:
> Dear advance C++ programers:
>
> * I copy book (C++ Primer 3rd chapter 17 book example text_query.C )
> can be download from http://comscigate.com/BookCode/cppbooks.htm


As far as I know, that book is not legally available for download. Or
are you referring to the source code downloads? Again, I'm not sure
if
A-W has the source legally available for download anywhere except
their site.



 
Reply With Quote
 
mrbrklyn
Guest
Posts: n/a
 
      06-24-2011
On Jun 23, 12:47*pm, red floyd <(E-Mail Removed)> wrote:
> On Jun 23, 2:30*am, eric <(E-Mail Removed)> wrote:
>
> > Dear advance C++ programers:

>
> > * I copy book (C++ Primer 3rd chapter 17 book example text_query.C )
> > can be download fromhttp://comscigate.com/BookCode/cppbooks.htm

>
> As far as I know, that book is not legally available for download. *Or
> are you referring to the source code downloads? *Again, I'm not sure
> if
> A-W has the source legally available for download anywhere except
> their site.


The copyright police. It happens to be a legal link to the source
code on a site that seems to have been around since 1998
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Pattern matching. Matching multiple lines from while reading from a file. Bobby Chamness Perl Misc 2 05-03-2007 06:02 PM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
g++296: no matching function for call to istrstream::str() A. Farber C++ 1 12-23-2004 06:23 PM
Pattern matching : not matching problem Marc Bissonnette Perl Misc 9 01-13-2004 05:52 PM
no matching function for call to explicit copy-constructor Dario C++ 2 09-22-2003 11:53 AM



Advertisments