Ok for your help i am describing here with an example hope it solves
your problem completely !
I am pasting the correct version of both the programs.
#include<iostream.h>
int main()
{
cout<<"Hello, World";
return(0);
}
[EMAIL PROTECTED] ~]$ vi 1.cpp
[EMAIL PROTECTED] ~]$ g++ -o 1 1.cpp
In file included from /usr/lib/gcc/i386-redhat-
linux/3.4.2/../../../../include/c++/3.4.2/backward/iostream.h:31,
from 1.cpp:1:
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c+
+/3.4.2/backward/backward_warning.h:32:2: warning: #warning This file
includes at least one deprecated or antiquated header. Please consider
using one of the 32 headers found in section 17.4.1.2 of the C++
standard. Examples include substituting the <X> header for the <X.h>
header for C++ includes, or <iostream> instead of the deprecated header
<iostream.h>.
Ok, when i compile the above program u should get a warning which is as
below this is concerned with the section 17.4.1.2 so you can refer what
that section says but it's no use
You can just simply ignore it !!
To disable this warning use -Wno-deprecated.
so i will write the compilation once again:-
[EMAIL PROTECTED] ~]$ vi 1.cpp
[EMAIL PROTECTED] ~]$ g++ -o 1 1.cpp -Wno-deprecated
Now you want get an error and your program will run satisfactorily
[EMAIL PROTECTED] ~]$./1
Now the Problem with namespaces here goes
#include<iostream>
using namespace std; // I am using namespace so i can
// remove .h
int main()
{
cout<<"Hello, World";
return(0);
}
[EMAIL PROTECTED] ~]$ vi 1.cpp
[EMAIL PROTECTED] ~]$ g++ -o 1 1.cpp
[EMAIL PROTECTED] ~]$ ./1
Hello, [EMAIL PROTECTED] ~]$
I hope this solves your query !
I have tried to explain the best that i can
if you have any more queries you can mail me offlist too
On 8/1/05, ranjit bhonsle <[EMAIL PROTECTED]> 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.
> Also on FC3 single quotation and double quotation does not
> print to screen.
> What gives?
> Thanks in advance for any suggestion.
> Ranjit.
>
> --
> ______________________________________________________________________
> Pune GNU/Linux Users Group Mailing List: ([email protected])
> List Information: http://plug.org.in/mailing-list/listinfo/plug-mail
> Send 'help' to [EMAIL PROTECTED] for mailing instructions.
>
--
______________________________________________________________________
Pune GNU/Linux Users Group Mailing List: ([email protected])
List Information: http://plug.org.in/mailing-list/listinfo/plug-mail
Send 'help' to [EMAIL PROTECTED] for mailing instructions.