c++ - 无法包含 ifstream "fatal error: ' ifstream' 找不到文件”

标签 c++ compiler-errors include

<分区>

这里发生了一些非常奇怪的事情。我做了一个非常简单的代码测试位来包含一个 if 流,我得到一个 fatal error :'ifstream' file not found on compilation。我怀疑这与编译器有关。

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

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

最佳答案

header 名称错误,没有 ifstream header 。如果你想使用 cout,你可能想包含 iostream:

#include <iostream> 

关于c++ - 无法包含 ifstream "fatal error: ' ifstream' 找不到文件”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16025523/

相关文章:

c++ - 使用指针数组作为方法的参数

c++ - 如何从 lua 脚本访问 C++ 类成员函数?

c++ - Visual Studio 在附加包含文件夹中找不到头文件

android - 无法在我的项目中包含 AndroidHttpTransport

c++ - LNK2005(已定义)找不到错误

C++ boost 理性类,floor 函数

java - 当我尝试在IntelliJ中运行Java类时,即使已成功编译并运行,也没有任何结果

java - 单击两个按钮 Swing

c++ - 如何判断包含头文件的位置?

string - ocaml 中的错误链接模块