Read the message again It doesn't say your constructor is protected, it says std::basic_ostream
's constructor is protected. Your class (or a parent thereof) has a std::basic_ostream
(or maybe std::ostream
) member, which cannot be default-constructed. You must construct it with an argument. This page shows that it must be cosntructed from a basic_streambuf<Elem, Tr>*
.
Now I'm going to extrapolate: You probably don't actually want a std::ostream
member in your class, you probably want a specific-derived type, or you want a reference, or (most likely) a an unknown or changable derived type. But since the nieve way to address the first two cases makes your class non-copiable, the final solution is virtually always the same: Use a std::unique_ptr<std::ostream>
instead if your class owns the stream, or a std::ostream*
if someone else owns it.
Finally: The full text for errors is in the "output" window of Visual Studio, not in the "Error" Window, which just shows summaries. The full text of that error would have many more details about the error, including (most likely) the name and line number of your class' default constructor.