Hello Ranjit,
ranjit bhonsle wrote:
Hello all,
Why does the gcc compiler give a lot of errors when using
iostream.h as a header file? Including iostream causes the
compiler to complain about cout and cin not being declared.
That is what the header file is supposed to provide.
I am a newbee where programming is concerned.
somebody had asked this query on the list and recieved no
reply, so I tried it.
The same source file compiles nicely on DevC++ on win with
warning about deprecated header file.
Even using Wno-deprecated does not compile.
I've been trying to search in vain for an article describing the issues with
including header files in std c++ programs which I had read looong back.
Anyways, the essential difference are:
for std c++ headers (or for that matter, any header in the std include path)
the '.h' has to be skipped and the include filename should be in '<>':
#include <iostream> .... correct
#include <iostream.h> ... incorrect
for including c headers, the '.h' should be present, or the header file name
should be preceded by 'c', if you use the '<>', else use quotes (""):
#include <stdio.h> ...correct
#include <cstdio> ...correct
#include "stdio.h" ...correct
#include <stdio> ....incorrect
#include <cstdio.h> ...incorrect
As far as "Including iostream causes the compiler to complain about cout and cin
not being declared." is concerned, after including iostream using
"#include <iostream>" , you would also have to mention "using namespace std" if
you want to use cin and cout without qualifying the namespace (ie: use it as cin
instead of std::cin)
Also on FC3 single quotation and double quotation does not
print to screen.
This I don't understand, could use give some sample code ??
Regards
Steve
--
______________________________________________________________________
Pune GNU/Linux Users Group Mailing List: (plug-mail@plug.org.in)
List Information: http://plug.org.in/mailing-list/listinfo/plug-mail
Send 'help' to [EMAIL PROTECTED] for mailing instructions.