Iostream库不包含在代码块中

iostream library not included in codeblocks

本文关键字:代码 包含 Iostream      更新时间:2023-10-16

我目前正在尝试代码块为我的c++编程,但我有麻烦让它编译,我没有在过去有过这个问题,我最近才开发它,我已经搜索谷歌徒劳的解决方案,最接近我是Code::块编译错误这并没有解决我的问题,我已经多次尝试卸载和安装代码块和mingw。错误是:

1|fatal error: iostream: No such file or directory|
||=== Build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===|

它只是一个基本的hello world程序在我的设置我有c++编译器列为mingw32-g++.exe。我已经尝试了好几天,让这个工作,请帮助。

#include <iostream> 
using namespace std; 
int main()
{
    cout << "hello worldn"; 
    return 0;
}

我遇到了同样的问题,那就是我将文件保存为c文件(例如HelloWorld.c)。当我将文件更改为HelloWorld.cpp开始工作时。因此,将文件名更改为。cpp

你把iostream文件放错地方了吗?

/* Using standard C++ calling (note that you should use namespace std for cout or add using namespace std;) */ 
#include <iostream>
int main()
{
    std::cout<<"Hello World!n";
    return 0;
}

我解决了这个问题只需使用c++编译器比如g++ g++ your project -o test然后是./test你的项目=你的文本代码的名称,如果你使用g++,还有一个注意事项你的文件在桌面打开文件管理器,点击桌面右键点击桌面(文件管理器)点击"打开终端"然后完成

我也有同样的"#include<没有这样的文件或目录错误!!但在我的例子中,这可能是扩展问题。Codeblocks将其保存为。c(默认扩展名)。只需保存程序的名称,后跟cpp。像"Myprogram.cpp"。希望对您有所帮助.....>