Mail Archives: cygwin/2002/10/15/16:57:54
Lapo,
I don't have a reference to std iostreams handy, but having seen errors like
this many times before, I can tell you what's up.
Even though it looks like there is an error in a system/standard header, it
is actually an indication of where the compiler ended up after
parsing/preprocessing when it discovered an error. The best way that I
figured out to decipher these types of errors is to ignore all the template
stuff (replace with "XXX") and read the errors themselves:
In copy constructor XXX: XXX is private XXX within this context
(repeated)
From this, I concluded that the template/class is using the common practice
of "hiding" the copy constructor by making it private (See Scott Meyers
"Effective C++" I believe). This is to enforce that the class isn't meant
to be copied. There are a few different scenarios when a copy constructor
is called. Meyers provides a good description of this practice in "Item 27:
Explicitly disallow use of implicitly generated member functions you don't
want" and "Item 45: Know what functions C++ silently writes and calls". I
also recommend reading "Effective STL", which has "Item 49: Learn to
decipher STL-related compiler diagnostics", with some useful information on
deciphering template errors.
I don't know what the solution in your case is without looking at your code.
You are using a subclass of std::basic_ios, most likely std::basic_ostream,
std::basic_istream or one of their fstream counterparts. Try experimenting
with using references if you are passing around an instance like this.
For example:
void readSomething(std::istream & in)
{
// ... some stuff to read from the stream
}
int main(int argc, char ** argv)
{
std::ifstream fin(argv[0]);
readSomething(fin);
}
-Abe
----- Original Message -----
> That's the error.. but seems strange to me that a system header has a
> problem, anyone has an idea?
>
> $ make
> g++ -ggdb -c -o icse.o icse.cc
> /usr/include/c++/3.2/bits/ios_base.h: In copy constructor
> `std::basic_ios<char,
>
> std::char_traits<char> >::basic_ios(const std::basic_ios<char,
> std::char_traits<char> >&)':
> /usr/include/c++/3.2/bits/ios_base.h:421: `std::ios_base::ios_base(const
> std::ios_base&)' is private
> /usr/include/c++/3.2/iostream:62: within this context
> /usr/include/c++/3.2/streambuf: In copy constructor
> `std::basic_filebuf<char,
> std::char_traits<char> >::basic_filebuf(const std::basic_filebuf<char,
> std::char_traits<char> >&)':
> /usr/include/c++/3.2/streambuf:486: `std::basic_streambuf<_CharT,
> _Traits>::basic_streambuf(const std::basic_streambuf<_CharT, _Traits>&)
> [with _CharT = char, _Traits = std::char_traits<char>]' is private
> /usr/include/c++/3.2/iostream:62: within this context
> make: *** [icse.o] Error 1
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -