C++/Software used for C++ programming
Expert: Ralph McArdell - 3/15/2007
QuestionHi, I am a novice to c++ programming. Currently I use "Turbo C" to practice programming.But I always get an error saying that "IOstream.h" is missing. what can I do?
Can you recommend any other software (free ware or trial ware) which I can use?
Thank you very much for your time.
AnswerWhat I received is that you are using "Turbo C" not "Turbo C++" (Turbo C plus plus). This implies that you either mistyped the name of the compiler you are using (or it was corrupted when posted through AllExperts - the + (plus) symbol is used as a special character in web pages and has to be properly escaped to be posted and AllExperts seem to do this on a trial and error basis when someone notices that a + (plus) symbol is missing) or you are confused about the difference between C and C++.
Firstly assuming it was not a mistype or corruption and you are using a C compiler:
C and C++ are not the same beasts. C++ is largely compatible with C (in fact the C 1990 ISO/ANSI standard, the updated C 1999 ISO/ANSI standard added some features not compatible with C++), but adds many additional features to support various other programming paradigms - namely object oriented and generic programming - in addition to the procedural and modular styles supported by C.
Hence it is not to be expected that a C compiler ship with C++ only library components such as the C++ IOStreams library - they cannot be used with C as they will use at least some C++ only features.
Assuming it was a mistype (or corruption) and you are using a C++ compiler:
I am not sure what the error implies from your description. Saying it is missing could mean that you did not include it (at the beginning of the source file):
#include <iostream.h>
Note the use of all lowercase letters in the header name. This is correct for all C and C++ standard library header file names. It does not matter too much on case insensitive file systems like those used with Microsoft systems but does for those used with other systems such as UNIX or Linux systems: <IOStream.h> and <iostream.h> refer to two different files on such systems. Also note the use of < and >. These tell the compiler that the header is a system (or language library) header rather than a user project header (in which case we would use an include directive of the form #include "myheader.h").
Alternatively it could mean that you tried to include it but the compiler was unable to locate it. There are two reasons I can think of for this.
The first possibility is that you have not set up your build environment to allow the compiler to locate the header file. For example it is common to specify directories to search for include files by setting some environment variable with the include files paths. As an example if you are using MS-DOS or setting up the build environment from within a DOS box or command console you might put the following in a batch file that is executed before you start to build your project (e.g. autoexec.bat for MS-DOS):
set INCLUDE=C:\INCLUDE;C:\PROJECTS\INCLUDE;C:\TURBOC\INCLUDE
Or if you are using a modern Windows system you could set it using a dialog. In Windows XP for example this is the Environment Variables dialog from System Properties accessed via a button at the bottom of the Advanced tab.
You can also often specify additional include paths on the compiler command line.
To see how to you do these things for your compiler you should consult the compiler documentation.
The other reason I can think of is because you do not have the file installed or it is misspelt (for example you #include <iostrem.h>).
One reason it may not be installed is because the compiler is only supplied with standard C++ library headers. All such headers have _no_ .h extension. This differs from "traditional" pre-standard C++ library headers where they all tended to have a .h extension. So the C++ standard compliant name for the "traditional" iostream.h header is just iostream:
#include <iostream>
Note that they are also often referred to as just "headers" and not "header files". This is linked to the reason the .h was removed from the name. It was thought that as the contents of the headers were standard a compiler could have this knowledge built into it. Including a particular standard header would mean that the compiler add the definitions and declarations for that header into the compilation data directly from its internal knowledge of such things. I do not know of a compiler that takes advantage of this possibility though!
Of course it could be a combination of the factors I have mentioned.
As to other software, what software were you after?
Many free development tools and libraries can be found from the Freecountry web site at
http://www.thefreecountry.com/ Free C++ compilers can be found at
http://www.thefreecountry.com/compilers/cpp.shtml Of particular interest if you use a modern version of MS Windows are Microsoft Visual C++ 2005 Express (see
http://msdn.microsoft.com/vstudio/express/visualc/) and the Bloodshed Dev-C++ development environment and the Mingw32 C and C++ Compilers and (see
http://www.bloodshed.net/devcpp.html and
http://www.mingw.org/).
As a Turbo C (or C++) person you might be interested in the new Turbo C++ Explorer (see
http://www.turboexplorer.com/cpp) - if you are not using this already!
Note that some of these might require quite a bit of hard disk space (maybe > 1GB).
If you cannot find what you are looking for from the Freecountry site then I suggest you perform a search of the Internet for what you are after using a search site such as Google (
http://www.google.com/) or Yahoo (
http://www.yahoo.com/).