ifstream 在 eclipse 中停止工作

ifstream stopped working in eclipse

我有一个一年没用过的C++项目。它曾经 运行 完美地打开文件:

Matrix pmatrix;
    pmatrix.readFromFile("pmtx.txt");

在函数中:

void Matrix::readFromFile(string filename){

            ifstream tmfile;
            tmfile.open(filename.c_str());

            if (!tmfile) {
                cout << "unable to open tm file";
                //return 1;
            }

etc
}

它一直告诉我"unable to open tm file"。我一直在为此伤脑筋。很明显这个文件在src的目录下,我把它复制到Debug和Release,我给了它完整的权限。我使用日食。

知道为什么它停止工作了吗?

eclipse 项目出了点问题。我创建了一个新项目,复制到现有文件中并且它有效。