Prev: missing file?
Next: map string to function
From: c19h28o2 on 16 Sep 2006 07:09 Hi, can anyone tell me what i'm doing wrong here... #include <iostream> #include <vector> #include <string> #include <sstream> using std::cout; using std::cin; using std::vector; using std::string; using std::stringstream; istream& isNumeric(istream& in); int main() { ...... on the istream& isNumer.... line I get the following error... error: expected constructor, destructor, or type conversion before '&' token Thanks Michael
From: James Dennett on 16 Sep 2006 08:39 c19h28o2 wrote: > Hi, > > can anyone tell me what i'm doing wrong here... > > #include <iostream> > #include <vector> > #include <string> > #include <sstream> > > using std::cout; > using std::cin; > using std::vector; > using std::string; > using std::stringstream; > > istream& isNumeric(istream& in); > > int main() > { > ..... > > on the istream& isNumer.... line I get the following error... > > error: expected constructor, destructor, or type conversion before '&' > token > > Thanks > > Michael You should write std::istream, or add a using declaration "using std::istream;". The compiler doesn't know what you mean by a plain (unqualified) "istream". -- James
From: c19h28o2 on 16 Sep 2006 08:53 James Dennett wrote: > c19h28o2 wrote: > > Hi, > > > > can anyone tell me what i'm doing wrong here... > > > > #include <iostream> > > #include <vector> > > #include <string> > > #include <sstream> > > > > using std::cout; > > using std::cin; > > using std::vector; > > using std::string; > > using std::stringstream; > > > > istream& isNumeric(istream& in); > > > > int main() > > { > > ..... > > > > on the istream& isNumer.... line I get the following error... > > > > error: expected constructor, destructor, or type conversion before '&' > > token > > > > Thanks > > > > Michael > > You should write std::istream, or add a using declaration > "using std::istream;". The compiler doesn't know what you > mean by a plain (unqualified) "istream". > > -- James Apologies, i noticed as i finished posting this!
From: Bart van Ingen Schenau on 16 Sep 2006 08:19 c19h28o2 wrote: > Hi, > > can anyone tell me what i'm doing wrong here... > > #include <iostream> > #include <vector> > #include <string> > #include <sstream> > > using std::cout; > using std::cin; > using std::vector; > using std::string; > using std::stringstream; > > istream& isNumeric(istream& in); Most likely, the compiler does not recognise istream as an existing type. You should either make it explicit that you want std::istream, or you should add using std::istream; to the using-declarations above. > > int main() > { > ..... > > on the istream& isNumer.... line I get the following error... > > error: expected constructor, destructor, or type conversion before '&' > token > > Thanks > > Michael Bart v Ingen Schenau -- a.c.l.l.c-c++ FAQ: http://www.comeaucomputing.com/learn/faq c.l.c FAQ: http://www.eskimo.com/~scs/C-faq/top.html c.l.c++ FAQ: http://www.parashift.com/c++-faq-lite/
From: Mike Wahler on 16 Sep 2006 14:22
"James Dennett" <jdennett(a)acm.org> wrote in message news:WfSOg.4423$8J2.4070(a)fed1read11... > c19h28o2 wrote: >> Hi, >> >> can anyone tell me what i'm doing wrong here... >> >> #include <iostream> >> #include <vector> >> #include <string> >> #include <sstream> >> >> using std::cout; >> using std::cin; >> using std::vector; >> using std::string; >> using std::stringstream; >> >> istream& isNumeric(istream& in); >> >> int main() >> { >> ..... >> >> on the istream& isNumer.... line I get the following error... >> >> error: expected constructor, destructor, or type conversion before '&' >> token >> >> Thanks >> >> Michael > > You should write std::istream, or add a using declaration > "using std::istream;". The compiler doesn't know what you > mean by a plain (unqualified) "istream". Also, note that 'std::istream' is declared by <istream>, which was not #included. Most compilers will have already exposed 'std::istream' when <iostream> was #included, but this is not guaranteed by the language standard. #include <istream> using std::istream; istream& isNumeric(istream& in); -Mike |