unable to access iostream

i was just hoping someone could help me with a small problem..i'm using windows xp os...whenever i compile a c++ prog.
there is an error message like "unable to open include file 'iostream.h"i tried to use iostream also.but it didn't solve.what to do.. any suggestions..
|
Last edited on
Wich compiler/IDE do you use?

Can you post an example of a code that doesnt work?
i 'm using turbo3 compiler...i was trying this programme..

#include<iostream.h>
int main()
{
int i, j, n=5;
for(i=1;i<=n;i++)
{
for(j=1;j<=2*i-1;j++)
cout<<'*';
cout<<endl;
}
}

while compiling i'm getting these errors.

cpp: unable to open include file"iostream.h"
undefined symbol cout
undefined symbol endl
Last edited on
(you can use the #format when uploading code)

I'm not familair with turbo3. However, there should be a include folder inside it. You could check or iostream is inside it.

Its normale to use iostream instead of iostream.h. Also, to access functions inside it, you need to make clear you are trying to access something in the 'standard namespace'. You can do this by writing "std::" before every cout, or add this right after the include statements: using namespace std; .

Try to compile this and if it doesnt work, post the errors you get:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

using namespace std; //tell the compiler you're using the standard namespace

int main()
{
int n=5; //you can declare i and j later
for(int i=1;i<=n;i++)
{
     for(int j=1;j<=2*i-1;j++)
     {
             cout<<'*';
             } // I would recommend to always use '{}' to avoid mistakes
     cout<<endl;
     }
     
     cin.ignore(); //pause the program before ending
     return 0;     //return 0

}
the iostream.h is an old version and now deprecated, iostream is now without extension in order to distinguish it from the previous header
Topic archived. No new replies allowed.