注册 登录
编程论坛 C++教室

fstream的问题

feixian406 发布于 2007-11-01 15:00, 455 次点击

源码:
#include "stdafx.h"
#include <iostream>
#include <fstream>

int _tmain(int argc, _TCHAR* argv[])
{
ofstream outfile("E:\\test.txt"); //A
return 0;
}
编译出错,说是A行的ofstream没定义,这是怎么回事呢?

3 回复
#2
aipb20072007-11-01 22:58
你用_tmain的话就要加个啥头文件
自己查下

还有名字空间std
#3
feixian4062007-11-02 11:18
解决了!加上using namespace std就好了,还有#include &lt;iostream&gt;不需要。谢谢aipb2007
#4
六道2007-11-03 00:32
using namespace std:
这个和编译器有关吧~VC6不需要~

[此贴子已经被作者于2007-11-3 0:33:00编辑过]

1