我正在将一个大型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.0vcincludeios(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
(没有一行是我写的)。
我会非常感谢任何帮助/提示/策略来定位这种类型的编译器错误。您将如何处理定位此类错误的问题?
您将如何处理定位此类错误的问题?
在源文件中执行grep
(regex搜索)以查找类似的内容
(([^,]+,)*, (std::)?of?stream [^&]