致命错误:iostream.h没有这样的文件或目录
问题描述:
可能重复:
没有这样的文件iostream.h包括
即使在用.cpp扩展名命名源文件后。我的编译器给出这个错误,在命令提示符和代码块。如何解决此问题?
Even after naming the source file with .cpp extension. my compiler gives this error, both in command prompt and Codeblocks. How can I fix this issue?
#include <iostream.h>
int main(){
cout<<"Hello World!\n";
return 0;
}
答
在标准C ++。它是1990年代以前的编译器的一部分,但它肯定不是C ++的一部分。
That header doesn't exist in standard C++. It was part of some pre-1990s compilers, but it is certainly not part of C++.
使用 #include< iostream>
。并且所有的库类都在 std ::
命名空间中,对于ex am ple std :: cout
。
Use #include <iostream>
instead. And all the library classes are in the std::
namespace, for example std::cout
.
此外,请丢弃任何提及您说的内容的书籍。
Also, throw away any book or notes that mention the thing you said.