我有两个语法?即使项目成功构建,也会出现错误.在我评论过的以下位置中,我的代码的某些部分在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)