I see several problems:
1. <iostream.h> is not part of standard C++. The 1998 C++ standard uses <iostream> (no ".h")
2. Both <iostream> and <string> are in the "std" namespace. To use anything in the standard namespace, you need to append "std::" before the function you are using (example std::cout instead of just cout)
Try: ---------------------------------------------------
#include <iostream>
int main()
{
std::cout << "hello world";
return EXIT_SUCCESS;
}
---------------------------------------------------
P.S.: The same with endl, goes to std::endl
Regards, Heiko
Hasan Shibly wrote:
Hello,
I have just installed Red Hat 9 (Fresh installation on a dual boot system with Win XP) on my system.
For some reason g++ compiler is giving me errors, even for the simple "Hello world" program.
#include <iostream> int main() { cout << "hello world"; return EXIT_SUCCESS; }
Below is the compilation error I am facing.
$ g++ test.cpp
test.cpp:5: 'cout' undeclared (first use this function) test.cpp:5: (Each undeclared identifier is reported only once for each function it appears in.)
Your help is highly appreciated.
Regards H@z@n