我得到两个语法?即使项目建立成功,也会出现错误。我的代码的某些部分突出显示为红色在Visual Studio中,我在评论以下位置:C++,无法打开源文件“ifstream”Visual Studio
#include <vector>
#include <string>
#include <iostream>
#include <ifstream> //include is highlighted// Error: cannot open source file "ifstream"
using namespace std;
class DictionarySorter{
public:
DictionarySorter(){
}
void readDic(string name){
ifstream dicFile (name); //dicFile is highlighted here// Error: incomplete type is not allowed
}
private:
vector<string> v;
};
我在引用一个Youtube教程,它使用了ifstream头....你是对的。 – haris