error C2248: 'std::basic_ios::basic_ios' : cannot access private member declared in class 'std::basic_ios'

问题:

 

1>compute.cpp

1>d:/microsoft visual studio 8/vc/include/fstream(933) : 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>        d:/microsoft visual studio 8/vc/include/ios(151) : 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_fstream<_Elem,_Traits>::basic_fstream(const std::basic_fstream<_Elem,_Traits> &)'

1>        with

1>        [

1>            _Elem=char,

1>            _Traits=std::char_traits<char>

1>        ]

1>Build log was saved at "file://f:/programe/compute/Debug/BuildLog.htm"

1>compute - 1 error(s), 0 warning(s)

========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

 

 

解决方法:

 

把代码中的  void readout(fstream opfile){}改为void readout(fstream& opfile){}

这里的void readout(fstream opfile)是自定义的读取文件中内容的函数

 

你可能感兴趣的:(ios,c,basic,Class,Access,compiler)