fatal error: iostream.h no such file or directory
That header doesn't exist in standard C++. It was part of some pre-1990s compilers, but it is certainly not part of C++.
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.
Fatal error: iostream: No such file or directory in compiling C program using GCC
Neither <iostream>
nor <iostream.h>
are standard C header files. Your code is meant to be C++, where <iostream>
is a valid header. Use a C++ compiler such as clang++
or g++
(and a .cpp
file extension) for C++ code.
Alternatively, this program uses mostly constructs that are available in C anyway. It's easy enough to convert the entire program to compile using a C compiler. Simply remove #include <iostream>
and using namespace std;
, and replace cout << endl;
with putchar('\n');
... I advise compiling using C99, C11 or C18 (eg. gcc -std=c99
, clang -std=c18
etc)
iostream.h: no such file or directory
In addition to changing to
#include <iostream>
You can also add
using namespace std;
before main if you want to use cout
without having to use std::cout
.
fatal error: iostream.h: No such file or directory
You want to include iostream
. iostream.h
was present in Stroustrup's C++:
The original iostream library was written to challenge the claim that
a terse, type safe I/O system needed special language support. 1 It
was developed at Bell Labs by Bjarne Stroustrup and shipped with the
original C++ compiler, CFront and described in the first edition of
Stroustrup's The C++ Programming Language. This version of the
iostream library lived in the headers iostream.h, fstream.h and so on.
The Standard C++ has the headers without the .h, so you want to:
#include <iostream>
Here is an article that discusses this.
Fatal error: iostream: No such file or directory #include iostream
You seem to have not installed C++ support in MinGW. If you are using the manual installation route, download the gcc-c++ dev, dll, and bin files. If you are using the automated GUI installer (recommended for newcomer to C++), make sure to check the C++ package:
Cygwin showing error iostream.h is unable to locate
change to
#include <iostream>
#include <cstdio>
int main(){
printf("Hai");
}
or with g++ -x c hai.c
or gcc hai.c
#include <stdio.h>
int main(){
printf("Hai");
}
Related Topics
Converting Between C++ Std::Vector and C Array Without Copying
Maximum Number of Parameters in Function Declaration
Windows & C++: Extern & _Declspec(Dllimport)
Differences Between Running an Executable with Visual Studio Debugger VS Without Debugger
C++ Standard Practice: Virtual Interface Classes VS. Templates
How to Create Objects While Adding Them into a Vector
When Do I Use Fabs and When Is It Sufficient to Use Std::Abs
Visual Studio: Link:Fatal Error Lnk1181: Cannot Open Input File
What Does 'Using Std::Swap' Inside the Body of a Class Method Implementation Mean
Is It Safe to Use the "This" Pointer in an Initialization List
How to Encode a String to Base64 Using Only Boost
In the Standard, What Is "Derived-Declarator-Type"