Joh*_*web 11
此标准标题的正确名称iostream
没有扩展名.
如果您的编译器仍然无法找到它,请尝试以下操作:
find /usr/include -name iostream -type f -print
Run Code Online (Sandbox Code Playgroud)
...按照编译器的文档将其添加到include路径中.
Mic*_*yan 10
标头<iostream.h>是一个过时的标题,从C++开始标准化为ISO C++ 1998(它来自C++ Annotated Reference Manual).标准C++标头是<iostream>.两者之间存在一些细微差别,最大的区别是<iostream>将包含的内容放入命名空间std中,因此您必须使用"std ::"限定cin,cout,endl,istream等.有点像黑客(它是一个黑客,因为头文件永远不应该包含"使用"指令,因为它们完全违背命名空间的目的),你可以定义"iostream.h"如下:
#ifndef HEADER_IOSTREAM_H
#define HEADER_IOSTREAM_H
#include <iostream>
using namespace std; // Beware, this completely defeats the whole point of
// having namespaces and could lead to name clashes; on the
// other hand, code that still includes <iostream.h> was
// probably created before namespaces, anyway.
#endif
Run Code Online (Sandbox Code Playgroud)
虽然这与原始的过时标题不完全相同,但对于大多数用途来说这应该足够接近(即应该没有任何东西或者很少需要修复的东西).