Reputation: 1087
I am converting a large VC++ 6.0 application to VS2010 and keep running into this error for one of the projects:
error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\ios(176) : see declaration of 'std::basic_ios<_Elem,_Traits>::basic_ios'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> This diagnostic occurred in the compiler generated function 'std::basic_ofstream<_Elem,_Traits>::basic_ofstream(const std::basic_ofstream<_Elem,_Traits> &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
Based on the error text and similar questions asked here, I assume that the error is caused by an instance of ofstream
passed directly into a functions, instead of being passed by reference.
The problem I have is, to locate the line of code in which the ofstream
is passed in the wrong way. The error message only links to the fstream header included in VS2010 and my project uses ofstream
all over the place in a code base of several tens of thousand lines of code (none of which written by me).
I would greatly appriciate any help / tips / strategies to locate this type of compiler error. How would you approach the problem of locating this kind of error?
Upvotes: 0
Views: 1075
Reputation: 363627
How would you approach the problem of locating this kind of error?
Do a grep
(regex search) in your source files for something like
\(([^,]+,)*, (std::)?of?stream [^&]
Upvotes: 1