在使用std::ofstream写文件时,编译器提示如下错误:
error: variable ‘std::ofstream ofs’ has initializer but incomplete type
std::ofstream ofs(string(TMP_STATE_FILE));
这个错误上由于没有保护头文件导致的。
包含上头文件,编译通过。
#include<fstream>
在使用std::ofstream写文件时,编译器提示如下错误:
error: variable ‘std::ofstream ofs’ has initializer but incomplete type
std::ofstream ofs(string(TMP_STATE_FILE));
这个错误上由于没有保护头文件导致的。
包含上头文件,编译通过。
#include<fstream>
下一篇:C/C++给文件加crc校验
std::ofstream 写文件
std::ifstream读取文件、std::ofstream写文件的示例
在编程总经常会用到读写文件,基本都是使用ofstream,ifstream,fstream
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M