No matching function to call C++

#include <iostream>
#include <string>
#include <fstream>
using namespace std;

int main()
 {
setlocale (LC_ALL, "rus");
string path = "MyFile.txt";
ifstream fin;
fin.open(path);

if (!fin.is_open())
{
    cout<< "Fail" << endl;
}
else
{
    cout << "Is OK!" << endl;
}
fin.close();

return 0;
 }

Выдает ошибку no matching function for call to 'std::basic_ifstream<char, std::char_traits >::open(std::string&) в строке fin.open(path);


Ответы (1 шт):

Автор решения: Kaktuts

Если с++11 недоступен, попробуйте path.c_str()

→ Ссылка