VC中使用了fstream,却总是报错,求大神指点
VC中想要使用 fstream ,但程序一运行总是报错,求大神指点该怎么解决
然后我从别人那儿得到一个程序,也是一样使用了fstream,那个程序在我电脑上跑就能编译,我完全复制那个程序,但还是不能编译,烫染后我看了看我的fstream和他的fstream内容不太一样。。。应该怎么改呢?我直接拷贝的话好像还是不行
这个infile是我从那个类向导中的成员变量中自定义自动生成的,类型fstream.
在Dlg.h中是这么定义的
protected:
// bool m_IsShow;
BOOL m_IsShow;
BOOL Flag;
CString str;
long int Num;
CTime TimerT;
fstream infile;
Dlg.h中头文件是
#pragma once
#include "Afxtempl.h "
#include "afxdlgs.h"
#include <fstream>
#include <iostream>
#include <time.h>
Dlg.cpp中头文件是
#include "stdafx.h"
#include "test15.h"
#include "test15Dlg.h"
#include "afxdialogex.h"
#include <fstream>
#include <iostream>
报错的内容是
1>c:\users\administrator\desktop\test15\test15\test15dlg.h(53): error C2146: 语法错误: 缺少“;”(在标识符“infile”的前面)
1>c:\users\administrator\desktop\test15\test15\test15dlg.h(53): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>c:\users\administrator\desktop\test15\test15\test15dlg.h(53): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1> test15.cpp
1>c:\users\administrator\desktop\test15\test15\test15dlg.h(53): error C2146: 语法错误: 缺少“;”(在标识符“infile”的前面)
1>c:\users\administrator\desktop\test15\test15\test15dlg.h(53): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>c:\users\administrator\desktop\test15\test15\test15dlg.h(53): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int