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>::operator++() [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<char>, 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<char>, 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<char>, 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<char>, 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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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>::operator>>(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