Why Can't G++ Find iOStream.H

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 ex­am­ple 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



Leave a reply



Submit