错误搜寻提示:错误 C2248: 'std::basic_ios<_elem ,_traits>::basic_ios' : 无法访问类中声明的私有成员
我正在将一个大型 VC++ 6.0 应用程序转换为 VS2010,并在其中一个项目中不断遇到此错误:
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> ]
根据错误文本和此处提出的类似问题,我假设该错误是由 ofstream 直接传递到函数中,而不是通过引用传递。
我遇到的问题是,找到以错误方式传递 ofstream
的代码行。错误消息仅链接到 VS2010 中包含的 fstream 标头,而我的项目在数万行代码(都不是我编写的)的代码库中到处使用 ofstream
。
我非常感谢任何帮助/提示/策略来定位此类编译器错误。您将如何解决定位此类错误的问题?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在源文件中执行
grep
(正则表达式搜索)以查找类似内容Do a
grep
(regex search) in your source files for something like