ifstream C++无法识别

Mat*_*ont -3 c++ ifstream

我正在用C++修改程序,我需要将一些值写入磁盘.

我已经#include <fstream>在Include部分中添加了,然后我尝试使用ifstream但未被识别:

IntelliSense:标识符"ifstream"未定义

我做错了什么?谢谢,

编辑:这是代码

#include <fstream>
#include "stdafx.h"
#include "CommandHandling.h"
#include "Conversions.h"
#include "INIFileRW.h"
#include "ComPortTimeout.h"

CCommandHandling::CCommandHandling()
{
    /* set up com port class, start from new. */
    pCOMPort = NULL;
    pCOMPort = new Comm32Port;
    ifstream test; //Here I get the error cited above
... //More code here
...
...
...

}
Run Code Online (Sandbox Code Playgroud)

jwi*_*mar 5

没有看到你的代码,我不能确定,但​​我要尝试的第一件事是看它是否接受std::ifstream.

如果就是这样,那么熟悉C++中的命名空间可能是值得的 - 它们无处不在.你无法避免它们.(不是我建议你应该这样做!)