Why can't g++ find iostream.h?
Before the C++ language was standardized by the ISO, the header file was named <iostream.h>
, but when the C++98 standard was released, it was renamed to just <iostream>
(without the .h
). Change the code to use #include <iostream>
instead and it should compile.
You'll also need to add a using namespace std;
statement to each source file (or prefix each reference to an iostream function/object with a std::
specifier), since namespaces did not exist in the pre-standardized C++. C++98 put the standard library functions and objects inside the std
namespace.
G++ not finding iostream.h in Ubuntu
Use #include <iostream>
- iostream.h
is not standard and may differ from the standard behaviour.
See e.g. the C++ FAQ lite entry on the matter.
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.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.
Dev C++ couldn't support with iostream.h header file in C++
First of all, Dev C is not a compiler, it's an IDE that interfaces with a compiler (most presumably GCC/MingW in your case). The compiler suite is the one having the header files, not the IDE.
Just do
#include <iostream>
instead of
#include <iostream.h>
and also add using namespace std;
to execute cout
and cin
in Dev C program.
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)
Related Topics
How to Use a Mask to Iterate Files in a Directory with Boost
How to Declare a Vector of Atomic in C++
Check If a Variable Type Is Iterable
Blending Does Not Remove Seams in Opencv
Warning: Format Not a String Literal and No Format Arguments
How to Get the Digits of a Number Without Converting It to a String/ Char Array
Portability of Binary Serialization of Double/Float Type in C++
C++ String to Double Conversion
How to Combine Several C/C++ Libraries into One
How to Get a List of Video Capture Devices (Web Cameras) on Linux ( Ubuntu )? (C/C++)
How to Detect Double Precision Floating Point Overflow and Underflow
Does Boost Have a Datatype for Set Operations That Is Simpler Than the Stl
How to Call a Function by Its Name (Std::String) in C++
Tools to Find Included Headers Which Are Unused
How to Sort a Std::Map First by Value, Then by Key
Visual Studio 2015 Doesn't Have Cl.Exe
How to Avoid Repeating the Class Name in the Implementation File