ofstream错误在c ++ [英] ofstream error in c++
本文介绍了ofstream错误在c ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在C ++中遇到一个流错误,这里是我的代码
int main(){
ofstream myfile;
myfile.open(example.txt);
myfile<< 将此文件写入file.\\\
;
myfile.close();
return 0;
}
Dev-C ++ 10中的
错误
C:\devp\main.cpp aggregate
$提前感谢
`std :: ofstream OutStream'有
不完整类型,不能定义解决方案您可以试试这个:
#include< fstream&
using namespace std;
int main(){
ofstream myfile;
myfile.open(example.txt);
myfile<< 将此文件写入file.\\\
;
myfile.close();
return 0;
}
I am getting an ofstream error in C++, here is my code
int main () { ofstream myfile; myfile.open ("example.txt"); myfile << "Writing this to a file.\n"; myfile.close(); return 0; }
error from Dev-C++ 10
C:\devp\main.cpp aggregate `std::ofstream OutStream' has incomplete type and cannot be defined
Thanks in advance
解决方案You can try this:
#include <fstream> using namespace std; int main () { ofstream myfile; myfile.open ("example.txt"); myfile << "Writing this to a file.\n"; myfile.close(); return 0; }
这篇关于ofstream错误在c ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文