gpt4 book ai didi

c++ - : error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 的错误搜索技巧

转载 作者:行者123 更新时间:2023-11-28 08:11:18 25 4
gpt4 key购买 nike

我正在将一个大型 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 header ,而我的项目在数万行代码的代码库中到处使用 ofstream(没有我写的代码)。

我会非常感谢任何帮助/提示/策略来定位此类编译器错误。您将如何解决定位此类错误的问题?

最佳答案

How would you approach the problem of locating this kind of error?

在源文件中执行 grep(正则表达式搜索)

\(([^,]+,)*, (std::)?of?stream [^&]

关于c++ - : error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 的错误搜索技巧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8987459/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com