无法识别ifstream c++
ifstream C++ not recognized
我正在用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++中的名称空间可能是值得练习的——它们无处不在。你无法避免它们。(不是我建议你这么做!)
相关文章:
- ifstream什么都没读
- ifstream文件在从行中读取时被清除
- std::ifstream::read 不会读取所有 512 字节,并设置 EOF 和失败位
- 将 ifstream 拆分为 n 个流?
- 如何将 std::ifstream 转换为 std::basic_istream<CharT, Traits>&?
- 我在 ifstream input_file(文件名)行中收到错误"no matching function to call";
- 尝试打开 ifstream 时出现"Incomplete type"错误
- 是否可以在没有真实文件的情况下创建 ifstream
- 虽然循环不读取整个 ifstream 文件
- std::ifstream 在读取文件中最后一项时设置 eofbit,但仅在读取数值类型时发生
- Ofstream和IFSTREAM有什么区别?
- 如何将QByteArray转换为std::istream或std::ifstream?
- ifstream 跳过数字,只写 0
- C++:std::ofstream 方法 open() 在第二次迭代时擦除打开的 ifstream 文件
- 在函数中声明的 ifStream 对象在发布模式下不起作用
- fstream / ifstream / ofstream 对象如何转换为布尔值
- ifstream 尝试读取 9 到 13 之间的无符号字符时非常奇怪的行为
- 尝试在 C++ 中为 ifstream 提供一个变量
- ifstream 读取的字符与文件中写入的字符不同
- 如何使用 ifstream 检查文件中变量的类型?