From: "Jim Fischer" Newsgroups: comp.lang.c++,comp.os.msdos.djgpp Subject: Re: passing istringstream as istream in param Date: Sun, 10 Sep 2000 19:32:32 -0700 Organization: Cal Poly Lines: 56 Message-ID: <8phi1k$9g0$1@cscnews.csc.calpoly.edu> References: NNTP-Posting-Host: synthis.ee.calpoly.edu X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Mostyn Lee" wrote in message news:f6Yt5.55$t42 DOT 3484 AT nsw DOT nnrp DOT telstra DOT net... > i used flex to generate a parser c++ class, and this class requires a > istream * as its parameter > > yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) > > i need to parse from a character buffer, and have created a istringstream. > the object will not accept the istringstream as a valid type parameter. > i am using visual c++ 6.0 with a GNU flex generated class > > > #include > #include > #include > // .... > using namespace std; > // .... > > string constructstring = ReturnsAString(); > istringstream lexingstream(constructstring); > lexingstream << constructstring; > > yyFlexLexer myyyFlexLexer(&lexingstream, std::cout); > // .... > > gets the error : > error C2664: '__thiscall yyFlexLexer::yyFlexLexer(class istream *,class > ostream *)' : cannot convert parameter 1 from 'class > std::basic_istream > *' to 'class istream > *' Possible answer #1) Sounds like VC++ is broken. You might visit the VC++ web site to see if there are any patches/updates (service packs) available for the specific version of VC++ you are using... Possible answer #2) Is the flex-generated code using the pre-ANSI (deprecated) iostream classes -- i.e., -- or the new ANSI-compliant iostream classes -- i.e., ??? There are some significant differences between the pre-ANSI and ANSI iostream classes -- i.e., the two are not 100% compatible. So you might want to check your source files (particularly the ones that flex generates) to see if your program is specifying both the pre-ANSI library (headers like "") and the ANSI library (headers like "") -- and not just the iostream headers. If so, then you need to fix your code so that it uses either the pre-ANSI library exclusively, or the ANSI library exclusively, and not both at the same time. Jim