2013-04-15 61 views
0

这里发生了一些非常奇怪的事情。我已经做了一个非常简单的测试代码来包含if流,并且我得到一个致命错误:在编译时未找到'ifstream'文件。我怀疑它与编译器有关。不能包含ifstream“致命错误:'ifstream'文件未找到”

#include <ifstream> 
using namespace std; 
int main(){ 
    cout <<"hello world" <<endl; 
} 

以上是使用命令clang ++ * .cpp -o“test”与clang编译的。

+0

什么是if流? –

+0

@ColeJohnson http://www.cplusplus.com/reference/fstream/ifstream/ –

回答

5

错误的标题名称,没有ifstream标题。如果您想要使用cout,您可能需要包含iostream

#include <iostream> 
+0

我想他们想要'iostream',因为那时他们正在尝试使用'cout'。 – Xymostech

+0

对,当我看到“”时,我甚至没有阅读其余的代码片段:)我将编辑答案,谢谢 – piokuc

+0

我想写入文件 - hello world只是测试代码的一部分如果它会运行 –