C++,无法打开源文件"ifstream"Visual Studio

har*_*ris 0 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;


};
Run Code Online (Sandbox Code Playgroud)

clc*_*cto 7

std::ifstream在标题中定义<fstream>.没有标准标题<ifstream>.