JZTXT
  • 首页
  • Ai
  • Java
  • Python
  • Android
  • Mysql
  • JavaScript
  • Html
  • CSS

【c&c++】[Error] iostream.h: No such file or directory的解决办法

发布时间 2023-04-24 18:23:34作者: opensmarty

直接上错误代码实例

#include <iostream.h>

int main()
{
    print('hello, world\n')
    return 0;
 } 

编译通不过,直接出错

 

这是C语言转C++的两条经典错误

  1. C++中是没有iostream.h这个东西的(或者一般不会这么使用),正确用法是:

    # include <iostream>

  2. 用了iostream还不能直接使用cin和cout,还需要添加命名空间:

    using namespace std;

    本栏目推荐文章
  • shared_ptr 循环引用以及解决办法
  • IDEA项目名称后面出现中括号,模块Modules的名子和文件夹名称不同,可以右键修改名称也可以在File->Project Structure 修改Modules的Name(快捷键ctrl+Shift+Alt+s)
  • net6 net8 发布失败的几个bug应急办法
  • A connection was successfully established with the server but then an error
  • vscode错误:Unable to connect to VS Code server: Error in request.
  • 【解决方案】Error running,Command line is too long
  • Pycharm读excel文件报错xlrd.biffh.XLRDError: Excel xlsx file not supported
  • Python中出现"No module named 'requests'"的图文解决办法
  • fish和pacman:“error: Unable to read input file: 是一个目录”报错的处理
  • 安装了open-vm-tools,还是没有办法拖文件到虚拟机或者将虚拟机的文件拖出来。
版权声明:本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。
联系我们