Results 1 to 8 of 8
Hi I am kind of new to Linux and these forums. I have a problem regarding g++ (gcc) utility. I was testing a simple hello world programme that compiles well ...
- 12-31-2005 #1Just Joined!
- Join Date
- Dec 2005
- Posts
- 22
compiler problem
Hi I am kind of new to Linux and these forums. I have a problem regarding g++ (gcc) utility. I was testing a simple hello world programme that compiles well under windows (borland Cpp compiler) but not under Linux the compiler complains that iostream.h is depriciated and to use iostream instead I tried this option and programme dose not recognise cout here is my source code
#include <iostream.h>
int main(int argc, char **argv)
{
cout << "Hello World";
return 0;
}
and I get the following error message
[wiraj@x1-6-00-09-6b-40-03-e7 Qt]$ g++ hello1.cpp
In file included from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.1/../../../../include/c++/3.4.1/backward/iostream.h:31,
from hello1.cpp:1:
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.1/../../../../include/c++/3.4.1/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>. To disable this warning use -Wno-deprecated.
A final note I am not sure if this is related or not but I have been having trouble compiling binaries downloaded as tar.gz files in my system. The make utility points me to some strange syntax errors in the code I am using gcc version 3.4.1 with mandrake 10.1
- 12-31-2005 #2
Hi - Read this.
I am always doing that which I can not do, in order that I may learn how to do it. - Pablo Picasso
- 12-31-2005 #3Just Joined!
- Join Date
- Dec 2005
- Posts
- 22
Oh that's a useful answer, please guys just tell me what's wrong with this. what am I doing wrong
- 12-31-2005 #4Yes, it is a useful answer. It shows exactly how to correct your problem.
Originally Posted by wirajR
The problem with your code is that you are using <iostream.h>, which is a deprecated header file. Instead, you should use #include <iostream>.
As you note, you get an error. Had you read the link that you were given, you would have noticed the line "using namespace std".
#include <iostream> gives access to cout, cin, and endl, all of which are in the "std" namespace. You may either incorporate the entire std namespace into your own program ("using namespace std"), or you may invoke each of these by their full name ("std::cout", "std::cin", "std::endl").DISTRO=Arch
Registered Linux User #388732
- 12-31-2005 #5Just Joined!
- Join Date
- Dec 2005
- Posts
- 22
Oh thank you very much sir. I totally missed the link above, I am new to these forums and not used to the way it works .
- 12-31-2005 #6Actually, one of the few things I dislike about the forum facelift is the formatting for links that are posted here. I am from a school that says links should underlined. As it is, they're neither underlined nor emphasized sufficiently.I totally missed the link above...
This thread is a perfect case in point: fingal posts a good answer, but it appears (because of the way links appear here) that he is telling the OP to read his signature, which of course makes no sense in this context.
- 01-01-2006 #7
I would actually recomend programming in the C language instead of C++, as C++ is a lot harder
- 01-01-2006 #8Just Joined!
- Join Date
- Dec 2005
- Posts
- 22
Thanks for your advice but I am more comfortable with OO. I am a Java programmer with 5 years experience and using only C would deny me most of the Java like features I am used to.


Reply With Quote