Originally Posted by shubham chakraborty
I am trying to run a simple program in ubuntu. GCC is installed. But still the following errors are being flashed .
I hope you use Synaptic for package management. It is easier than other front ends to apt. In Synaptic find the packages named libstdc++6-?.?-dev with various numbers for the ?.?. You should have one of those installed. If you do already, I've mis diagnosed the problem. If you don't, you need to install one. I'm not certain which one. Assuming you already have libstdc++6 installed, look at the version number of that and select the matching version of libstdc++6-?.?-dev
For example, on my Mepis system I have version 4.3.2-1.1 of libstdc++6 installed and the same version of libstdc++6-4.3-dev installed. There is libstdc++6-4.1-dev and libstdc++6-4.2-dev available, not installed. But of course neither of them has a version number starting with 4.3
Originally Posted by Nylex
You need to use "iostream" rather than "iostream.h". I believe this is part of the newer C++ standard (ANSI C++?), but I'm not sure. Some distros provide the older headers (i.e. the ones with the ".h") for backwards compatibility, but it seems that Ubuntu isn't one of them.
I think all of that is incorrect.
iostream.h is part of the package libstdc++-dev in Ubuntu. I doubt any distribution would split up the std C++ headers the way you describe. I think the backwards compatibility ones are always included.
Since the OP can't find iostream.h, I assume he is missing all those headers (current ones as well as backwards compatibility ones).
I think there is some higher level package group that would include libstdc++-dev as well as other packages the OP will need. But I don't know how to look up which groups include a package. Installing the required packages one at a time as you hit error messages will get the job done. Installing the group would be easier if you knew its name.
Also, you'll need a "using namespace std;" under your include directives and before main(), i.e.
This is because cout is declared in the "std" namespace, so you need to specify that you want to use that namespace.
using namespace std;
// Code here
That is another difference between iostream.h and iostream. If you use iostream.h, you don't need the using namespace std
I'm not particularly recommending using iostream.h instead of iostream. I just don't think that is the OP's current problem.