问题遇到的现象和发生背景
本人突发奇想,写了一个自动排课表的程序,想用json文件存储相关信息(teachers&classes的信息),并用jsoncpp库实现json文件的解析,在解析文件函数中,报错E0304:没有与参数列表匹配的重载函数Json::Reader:parse实例,更改字符编码集无解
问题相关代码
C++
//open file
cout << "enter the path of config file " << endl ;
string path ;
cin >> path ;
std::ifstream ConfigFile ( path , ios::binary);
if (!ConfigFile.is_open())
{
cout << "open json file failed." << endl;
return -1;
}
//classes info
int lspday = 7 ;
int weekdays = 5 ;
int t_nums , c_nums ;
int l = 0 , k = 0 ;
srand(time(0)) ;
if (!ConfigReader.parse ( ConfigFile , ConfigReader )) //报错地点
{
// 解析失败
cout << "Json文件解析失败!" << endl ;
return -2 ;
}
运行结果及报错内容
编译失败,报错E0304:没有与参数列表匹配的重载函数Json::Reader:parse实例