W. Paul Mills wrote:
The following program compiles with g++-2.95, but not with g++-3.2. Any idea why? Use old style "#include <iostream.h>" and it works in 3.2.
This is because all of the iostream functions are declared inside a namespace called std. Two possible fixes follow:
Paul // hello.C #include <iostream>
either put the following line here, this will expose every thing in namespace std, so you don't need to do it explicitly each time you use something within std:
using namespace std;
int main(void) { cout << "Hello World!\n";
or substitute the following here instead, this explicitly uses cout from namespace std, and so you would need to do it each time you used cout, cin, endl... etc:
std::cout << "Hello World!\n";
return 0; }
HTH, Barney.