Timtro
March 18th, 2007, 11:03 PM
Hello all,
This is an embarrassing question for me to ask. I haven't used C++ in a long time. I fell to C, then all the way to Fortran (clearly for scientific work). Now I want to go back and pick up some C++ again, and perhaps start writing some nice GUI stuff :)
Anyhow, I figured the best place to start is a nice "Hello World" program. I sat and squinted and scratched my head, and belted out a few lines from my memory:
#include <iostream>
int main()
{
cout << "Hello World!"<< endl;
return 0;
}
I brought up my terminal and g++'d my code and!! it didn't work.
I did some googling and found that I needed to add
using namespace std;
to my preamble (the bit before main() ). Why? What on earth has happened? Are my old C++ books 1994 obsolete?
Thanks.
This is an embarrassing question for me to ask. I haven't used C++ in a long time. I fell to C, then all the way to Fortran (clearly for scientific work). Now I want to go back and pick up some C++ again, and perhaps start writing some nice GUI stuff :)
Anyhow, I figured the best place to start is a nice "Hello World" program. I sat and squinted and scratched my head, and belted out a few lines from my memory:
#include <iostream>
int main()
{
cout << "Hello World!"<< endl;
return 0;
}
I brought up my terminal and g++'d my code and!! it didn't work.
I did some googling and found that I needed to add
using namespace std;
to my preamble (the bit before main() ). Why? What on earth has happened? Are my old C++ books 1994 obsolete?
Thanks.