请教C++读取CSV文件到vector 问题
vector <double> read_file(string path){
ifstream file(path);
string number;
vector <double> num ={};
if (!file.is_open())
{
cout<<"Fail to open the file!"<<endl;
}
while (!file.eof()){
vector <double> num = {};
getline(file,number,',');
num.push_back(stod(number));
}
file.close();
cout<<num.size() << " numbers loaded!" <<endl;
return num;
}
我刚刚C++入门,写了这个读取CSV文件(文件为逗号分隔开的很多数字)并存储到vector里,报错说是linker有错误,但我搜了一下也不懂是什么,请前辈指点一下!