* How to construct an object derived from class ostream in g++ version 3
@ 2002-06-18 12:28 Edwin Chan/Toronto/IBM
2002-06-18 15:35 ` Claudio Bley
0 siblings, 1 reply; 2+ messages in thread
From: Edwin Chan/Toronto/IBM @ 2002-06-18 12:28 UTC (permalink / raw)
To: gcc-help
Here's a test file to show what I really meant.
#include <iostream.h>
class PageStream: virtual public ios, public ostream{
public:
PageStream();
};
PageStream::PageStream(){}
int main(){return 0;}
This is the error message:
t.cpp: In constructor `PageStream::PageStream()':
t.cpp:11: no matching function for call to `std::basic_ostream<char,
std::char_traits<char> >::basic_ostream()'
/.../torolab.ibm.com/fs/projects/vabld/run/gcc/3.0.3/include/g++-v3/bits/std_ostream.h:177:
candidates are: std::basic_ostream<_CharT, _Traits>::basic_ostream(const
std::basic_ostream<_CharT, _Traits>&) [with _CharT = char, _Traits =
std::char_traits<char>]
/.../torolab.ibm.com/fs/projects/vabld/run/gcc/3.0.3/include/g++-v3/bits/std_ostream.h:67:
std::basic_ostream<_CharT, _Traits>::basic_ostream(std::basic_streambuf
<_CharT, _Traits>*) [with _CharT = char, _Traits = std::char_traits<char>]
What is required to match the function call? Is there something missing in
the constructor?
Thank you for your acknowledgement.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to construct an object derived from class ostream in g++ version 3
2002-06-18 12:28 How to construct an object derived from class ostream in g++ version 3 Edwin Chan/Toronto/IBM
@ 2002-06-18 15:35 ` Claudio Bley
0 siblings, 0 replies; 2+ messages in thread
From: Claudio Bley @ 2002-06-18 15:35 UTC (permalink / raw)
To: Edwin Chan/Toronto/IBM; +Cc: gcc-help
>>>>> "Edwin" == Edwin Chan/Toronto/IBM <edwinc@ca.ibm.com> writes:
Edwin> Here's a test file to show what I really meant. #include
Edwin> <iostream.h> class PageStream: virtual public ios, public
Edwin> ostream{ public: PageStream(); };
Edwin> PageStream::PageStream(){} int main(){return 0;}
Edwin> candidates are: std::basic_ostream<_CharT,
Edwin> _Traits>::basic_ostream(const std::basic_ostream<_CharT,
Edwin> _Traits>&) [with _CharT = char, _Traits =
Edwin> std::char_traits<char>]
Edwin> /.../torolab.ibm.com/fs/projects/vabld/run/gcc/3.0.3/include/g++-v3/bits/std_ostream.h:67:
Edwin> std::basic_ostream<_CharT,
Edwin> _Traits>::basic_ostream(std::basic_streambuf <_CharT,
Edwin> _Traits>*) [with _CharT = char, _Traits =
Edwin> std::char_traits<char>]
Edwin> What is required to match the function call? Is there
Edwin> something missing in the constructor?
GCC already told you which constructors are available.
You're trying to use the default constructor of class ostream which is
declared protected in its base class basic_ios<>.
You need to use one of the other constructors:
ostream(streambuf*) or ostream(const ostream&)
Claudio
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-06-18 22:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-18 12:28 How to construct an object derived from class ostream in g++ version 3 Edwin Chan/Toronto/IBM
2002-06-18 15:35 ` Claudio Bley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).