Where to Get 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.

where to locate iostream.h in centos which had installed gcc-c++ rpm?

Interestingly enough, the iostream header doesn't end with .h which is probably why you weren't able to find it. The quick and dirty answer on how to find out where it is located:

rpm -ql libstdc++-devel | grep iostream
/usr/include/c++/4.4.4/iostream

I got that by first trying to see if the iostream library was installed with gcc-c++ as you indicated.

# if gcc-cc++ is installed
rpm -ql gcc-c++ | grep iostream
# or if gcc-c++ isn't installed
rpm -qlp gcc-c++ | grep iostream

Finding nothing I got a list of dependencies for gcc-c++ via the following command.

# if gcc-cc++ is installed
rpm -qR gcc-c++
# or if gcc-c++ isn't installed
# no idea

Which returns the following on Centos 6.5:

gcc = 4.4.7-4.el6
libc.so.6()(64bit)
libc.so.6(GLIBC_2.11)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libc.so.6(GLIBC_2.7)(64bit)
libdl.so.2()(64bit)
libdl.so.2(GLIBC_2.2.5)(64bit)
libgmp.so.3()(64bit)
libmpfr.so.1()(64bit)
libstdc++ = 4.4.7-4.el6
libstdc++-devel = 4.4.7-4.el6
libstdc++.so.6()(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PartialHardlinkSets) <= 4.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(VersionedDependencies) <= 3.0.3-1
rtld(GNU_HASH)
rpmlib(PayloadIsXz) <= 5.2-1

Making an educated guess that devel rpms typically hold header files I just ran the command I indicated at the beginning and did a grep to get the answer. These are just some general debugging tips that I hope you might find useful while playing around with the Red Hat family of linux.

How do I find the iostream header file in a Visual Studio C++ project?

iostream is not part of your project. It's part of c++ standard library. How about searching your HDD for it?

What is the différence between #include iostream.h and #include iostream?

Before C++ was even standardised, the I/O library was developed as <iostream.h>. However, that header has never been a standard C++ header. Some older compilers continued to distribute the <iostream> header also as <iostream.h>. Use <iostream> because it is guaranteed by the standard to exist.

It's worth noting that the only standard headers that end with .h are the C standard library headers. All C++ standard library headers do not end with .h.

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.

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.

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



Leave a reply



Submit