从哪里获取 iostream.h

发布于 2024-09-18 16:03:31 字数 61 浏览 4 评论 0原文

我正在尝试在 Linux 中做一些事情,但它抱怨找不到 iostream.h。我需要安装什么才能获取此文件?

I'm trying to make something in Linux, but it complains that it can't find iostream.h. What do I need to install to get this file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

淤浪 2024-09-25 16:03:31

该标准标头的正确名称是iostream,不带扩展名。

如果您的编译器仍然找不到它,请尝试以下操作:

find /usr/include -name iostream -type f -print

...并将其添加到您的包含路径中,按照编译器的文档进行操作。

The correct name of this standard header is just iostream without an extension.

If your compiler still cannot find it, try the following:

find /usr/include -name iostream -type f -print

...and add it to your include path, following your compiler's documentation.

删除会话 2024-09-25 16:03:31

标头是是 C++ 标准化为 ISO C++ 1998 之前的过时标头(来自 C++ Annotated Reference Manual)。标准 C++ 标头是。两者之间有一些细微的差别,最大的差别是。将包含的内容放在命名空间 std 中,因此您必须使用“std::”限定 cin、cout、endl、istream 等。作为某种黑客(这是一种黑客,因为头文件不应该包含“using”指令,因为它们完全违背了命名空间的目的),您可以按如下方式定义“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

虽然这与原始文件并不完全相同过时的标头,这对于大多数用途来说应该足够接近(即应该没有任何东西或需要修复的东西很少)。

The header <iostream.h> is an antiquated header from before C++ became standardized as ISO C++ 1998 (it is from the C++ Annotated Reference Manual). The standard C++ header is <iostream>. There are some minor differences between the two, with the biggest difference being that <iostream> puts the included contents in namespace std, so you have to qualify cin, cout, endl, istream, etc. with "std::". As somewhat of a hack (it is a hack because header files should never contain "using" directives as they completely defeat the purpose of namespaces), you could define "iostream.h" as follows:

#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

While this is not exactly identical to the original antiquated header, this should be close enough for most purposes (i.e. there should be either nothing or very few things that you will have to fix).

娇俏 2024-09-25 16:03:31

我需要在 Debian 上编译partport并且遇到了问题(CentOS 4.5 工作正常)。我这样做没有成功:

ln -s /usr/include/c++/4.5/iostream /usr/include/c++/4.5/iostream.h

我发现iostream.h是由C++提供的,并且我在CentOS 4.5上找到了它。

所以我将文件 iostream.h 从 CentOS 4.5 复制到 Ubuntu 11.04 (Natty Narwhal),它工作了:

scp [email protected]:/usr/include/c++/3.3.4/backward/iostream.h /usr/include/c++/4.5/iostream.h

I needed to compile partport on Debian and had problems (CentOS 4.5 worked fine). I did this without any success:

ln -s /usr/include/c++/4.5/iostream /usr/include/c++/4.5/iostream.h

I discovered that iostream.h was provided from C++, and I found it on CentOS 4.5.

So I copied the file iostream.h from CentOS 4.5 to Ubuntu 11.04 (Natty Narwhal), and it worked:

scp [email protected]:/usr/include/c++/3.3.4/backward/iostream.h /usr/include/c++/4.5/iostream.h
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文