我正在使用Mac,并且正在学习C++。我试图打开并阅读一个文件,我写了几行代码来做到这一点。但是当我使用gcc或g ++或clang编译它时,编译器会失败,因为它找不到istream文件。有没有办法再次安装或下载默认库。谢谢ifstream在Mac上找不到文件
编辑:
这是代码:
#include <ifstream>
using namespace std;
int main()
{
ifstream ligand("ligand_dataset.txt");
if(ligand.is_open())
{
cout << "File ok";
}
else cout << "Unable to open the file";
return 0;
}
我们展示你的代码。你想包括什么确切的文件? – duskwuff