0

There is a problem in compiling in C++ program

error: iostream.h no such file or directory

I used make hello where hello.cpp is my filename.

2
  • 3
    Try #include <iostream> Commented Nov 19, 2013 at 12:19
  • Possible duplicate of Why can't g++ find iostream.h? Commented Aug 12, 2018 at 11:25

3 Answers 3

2

Use

#include<iostream>

The name iostream.h is deprecated.

Sign up to request clarification or add additional context in comments.

3 Comments

Not just deprecated; it hasn't been a standard header since at least 1998.
@MikeSeymour Yes, you're right. This is quite well explained in the link I provided in my answer.
According to "The C++ Standard Library" by Josuttis, it's deprecated. From page 41: "there is no specification in the standard. Hence, they are not supported. In practice, most vendors will probably provide them to enable backward compatibility"
1

Use #include <iostream> instead of #include <iostream.h>

If you want to know why iostream.h was outdated, I suggest reading: Why is #include outdated

Comments

-2
#include<iostream>
using namespace std;

that is the first code I ve write

4 Comments

You should never use using namespace std in headers.
Maybe this is the first Hello World of his programing career, do you want him konw those complex rules
@Patato, ideally - yes.
@Patato: Using properly qualified names is no more "complex" than learning an incantation to dump them into the wrong namespace, and is a better habit to get into.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.