我就写了个最简单的小程序 为什么还是编译出错
程序如下:
#include <fiostream.h>
using namespace std;
int main () {
ofstream examplefile ("example.txt");
if (examplefile.is_open()) {
examplefile << "This is a line.\n";
examplefile << "This is another line.\n";
examplefile.close();
}
return 0;
}
错误提示如下:
/root/qxhonker/c/exp4/src/exp4.cpp:2:27: error: fiostream.h: 没有那个文件或目录
/root/qxhonker/c/exp4/src/exp4.cpp: In function ‘int main()’:
/root/qxhonker/c/exp4/src/exp4.cpp:5: error: ‘ofstream’ was not declared in this scope
/root/qxhonker/c/exp4/src/exp4.cpp:5: error: expected `;' before ‘examplefile’
/root/qxhonker/c/exp4/src/exp4.cpp:6: error: ‘examplefile’ was not declared in this scope
gmake[2]: *** [exp4.o] 错误 1
gmake[2]: 由于错误目标“all”并未重新创建。
gmake[1]: *** [all-recursive] 错误 1
gmake: *** [all] 错误 2
*** 退出状态:2 ***