【发布时间】:2011-04-11 12:39:30
【问题描述】:
我正在尝试在 Linux 中制作一些东西,但它抱怨找不到 iostream.h。我需要安装什么才能获取此文件?
【问题讨论】:
-
这是您要使用的代码中的一个错误。如果可能,您应该向项目的维护人员提供错误报告。
我正在尝试在 Linux 中制作一些东西,但它抱怨找不到 iostream.h。我需要安装什么才能获取此文件?
【问题讨论】:
这个标准头的正确名称只是iostream,没有扩展名。
如果您的编译器仍然找不到它,请尝试以下操作:
find /usr/include -name iostream -type f -print
...并按照编译器的文档将其添加到包含路径中。
【讨论】:
g++ 在将#include 指令修复为iostream 后没有编译它,我会感到惊讶。
头文件
#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
虽然这与原始的过时标头并不完全相同,但对于大多数用途而言,这应该足够接近(即,您应该没有任何问题或需要修复的东西很少)。
【讨论】:
我需要在 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 上找到了它
所以我从 centos 4.5 复制到 ubuntu natty 文件 iostream.h 并且它有效
scp root@ip.centos-4.5:/usr/include/c++/3.3.4/backward/iostream.h /usr/include/c++/4.5/iostream.h
【讨论】: