g++ compiler help
hello
i am a first time linux user and had just installed RH Linux 8 on my PC. i seem to have a problem using the g++ compiler. my code is: #include<iostream> int main(){ cout<<"Hello World"; return 0; } the compiler error that i get is: Hello.cc:3:'cout' undeclared(first use this function) Hello.cc:3:each undeclared identifier is reported only once for each function it appears in.) help, anyone? thanks! |
you are not using cout in teh correct namespace. either say:
Code:
using namespace std; Code:
std::cout<<"Hello World"; Code:
cout<<"Hello World" << endl; |
thanks!
how come you have add that extra piece of code just to make iostream work? i have been writing and compiling in RH Linux 7.3 and the '#include<iostream>' alone worked fine. thanks again |
i don't know, if it was working before, it was wrong somewhere alogn the line.
|
Quote:
'std::' or the usage of 'using namespace std;' (which, btw, isn't encouraged) is only about 4 years old :} and some compiler-builders are slow to respond ;) Cheers, Tink |
All times are GMT -5. The time now is 10:32 AM. |