无法识别ifstream c++

ifstream C++ not recognized

本文关键字:c++ ifstream 识别      更新时间:2023-10-16

我正在用c++修改一个程序,我需要把一些值写入磁盘。

我在Include部分添加了#include <fstream>,然后我试图使用ifstream,但无法识别:

智能感知:标识符"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
...
...
...
}

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

如果是这样的话,那么熟悉c++中的名称空间可能是值得练习的——它们无处不在。你无法避免它们。(不是我建议你这么做!)