このエラーの原因となっているスクリプトの何が間違っているのか、少し混乱しています。
ゲーム設定のフィルを呼び出す関数がありますが、getline が気に入りません。
また、これらは私がそれに含めたファイルです:
#include <fstream>
#include <cctype>
#include <map>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;'
これは私が持っているものです:
std::map<string, string> loadSettings(std::string file){
ifstream file(file);
string line;
std::map<string, string> config;
while(std::getline(file, line))
{
int pos = line.find('=');
if(pos != string::npos)
{
string key = line.substr(0, pos);
string value = line.substr(pos + 1);
config[trim(key)] = trim(value);
}
}
return (config);
}
関数は私のからこのように呼び出されますmain.cpp
//load settings for game
std::map<string, string> config = loadSettings("settings.txt");
//load theme for game
std::map<string, string> theme = loadSettings("theme.txt");
どこで私は間違えましたか ?助けてください!
エラー:
settings.h(61): error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::string'