ios_base.h中的C++错误

MBZ*_*MBZ 2 c++ gcc

/usr/include/c++/4.4/bits/ios_base.h:在成员函数'std :: basic_ios>&std :: basic_ios> :: operator =(const std :: basic_ios>&)':
/usr/include/c ++/4.4/bits/ios_base.h:793:错误:'std :: ios_base&std :: ios_base :: operator =(const std :: ios_base&)'是私有的
/usr/include/c++/4.4/iosfwd:47:错误:在此上下文中
/usr/include/c++/4.4/iosfwd:在成员函数'std :: basic_ostream>&std :: basic_ostream> :: operator =(const std :: basic_ostream>&)':
/usr/include /c++/4.4/iosfwd:56:注意:合成方法'std :: basic_ios>&std :: basic_ios> :: operator =(const std :: basic_ios>&)'首先需要
/usr/include/c++/4.4/iosfwd:在成员函数'std :: basic_ofstream>&std :: basic_ofstream> :: operator =(const std ::)basic_ofstream>&)':
/usr/include/c++/4.4/iosfwd:84:注意:合成方法'std :: basic_ostream>&std :: basic_ostream> :: operator =(const std :: basic_ostream>&)'首先需要
/usr/include /c++/4.4/streambuf:在成员函数'std :: basic_filebuf>&std :: basic_filebuf> :: operator =(const std :: basic_filebuf>&)'中:/usr/include/c++/4.4/streambuf:778
:错误:'std :: basic_streambuf <_CharT,_Traits>&std :: basic_streambuf <_CharT,_Traits> :: operator =(const std :: basic_streambuf <_CharT,_Traits>&)[with _CharT = char,_Traits = std :: char_traits]'是私有的
/usr/include/c++/4.4/iosfwd:78:错误:在此上下文中
/usr/include/c++/4.4/iosfwd:在成员函数'std :: basic_ofstream>&std :: basic_ofstream>中: :operator =(const std ::basic_ofstream>&)':
/usr/include/c++/4.4/iosfwd:84:注意:这里首先需要合成方法'std :: basic_filebuf>&std :: basic_filebuf> :: operator =(const std :: basic_filebuf>&)'

任何人都知道这个错误是什么?

更新:它来自以下行:

ofstream myOutStream = ofstream(myCurrentLogName.c_str(), ios::app);
Run Code Online (Sandbox Code Playgroud)

sbi*_*sbi 6

您正在尝试复制或分配流(std::istream或的后代std::ostream).但是,无法复制或分配流.

编辑

将您的代码更改为:

std::ofstream myOutStream(myCurrentLogName.c_str(), std::ios::app);
Run Code Online (Sandbox Code Playgroud)