In the past, prior to G++ version 4.3, a code like
#include <iostream.h>
int main() {
cout << “hello world” << endl;
return 0;
}
would probably compile (g++ <filename.cpp>) with the possibility of some warning messages. With version 4.3 and newer, it will give you an error message stating that
iostream.h: No such file or directory
There are mainly 2 changes here; (1) GCC 4.3 does not recognize iostream.h anymore and will comply with the latest C++ standards of using iostream and (2) you will need to have “using namespace std;” at the top for it to recognize iostream.
using namespace std;
#include <iostream>
int main() {
cout << “hello world” << endl;
return 0;
}
And compile it with g++.
This is only IF you have not been following proper C++ standards and especially so, when you mix C and C++ code together. If you did learned to code C++ properly, you would not have such an issue anyway.



No comments yet.