On 23 June 2011 10:30, eric <cneric12lin0@xxxxxxxxx> 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 > 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&)’ You probably want istream_iterator<string, char> not istream_iterator<string, int> And indeed the code shows: istream_iterator< string, diff_type > input_set( infile ), eos; which is wrong, it should be char not diff_type. This code is quite badly broken, it's going to be very difficult to learn C++ from it unless you find corrected versions of the code. Have you tried the 4th edition of C++ Primer? Why are you using a book from last century?