Unable to open include file IOSTREAM

Feb 5, 2011 at 3:55pm
Hi, I just wrote my first program hello world.

I'm getting the compilation error (unable to open include file 'iostream')

Please help
Feb 5, 2011 at 3:59pm
Either you are compiling the source as a C program instead of C++ or... well, actually that's it. If the compiler is set up correctly, it should know where it's own standard includes are. Try replacing #include <iostream> with #include <stdio.h>, if that works you are using the wrong compiler.
Feb 5, 2011 at 4:12pm
thanks for the reply

I tried #include <studio.h>, still the same compiling error.

How do I compile it as a c++ promgram? I'm unsing turbo c++ compiler using a dosbox0.74 in windows7 64 bit.
Feb 5, 2011 at 4:26pm
studio.h


There's no such file. You've made a spelling mistake. Perhaps you made similar spelling mistake on iostream.

turbo c++ compiler using a dosbox0.74 in windows7 64 bit.


I see. Which version of Turbo C++ is it? If you have to run it under DOS, I'm guessing pretty old. Maybe you've got such an old version that it just isn't compliant to the standard. Get yourself something more recent.
Last edited on Feb 5, 2011 at 4:29pm
Feb 5, 2011 at 4:34pm
Why are you using Turbo C++?

You could try running your code here: http://codepad.org/

That will tell you if the problem is with your code or your compiler.
Feb 5, 2011 at 4:36pm
It's stdio.h, NOT studio.h - i made the same mistake when I started. if it runs in dosbox, it might not be standard conform, in that case you'd have to include iostream.h instead of iostream. If that's the case though, I'd recommend you to not use it, unless it's enforced by your professor or something.
Feb 5, 2011 at 5:02pm
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
using namespace std;

int main ()
{

    cout<<"Hello world!"<<endl;
     
    system("pause");

    return 0;
}



Where is the problem? :D
Feb 5, 2011 at 5:06pm
Janian wrote:
Where is the problem? :D



system("pause");
Right there :)
Last edited on Feb 5, 2011 at 5:07pm
Feb 5, 2011 at 5:37pm
you need to add <cstdlib> for that system command to work on any other compiler. be careful when posting code from microsoft compilers they allow you to use functions from various header files without them actually being included.
Feb 5, 2011 at 5:49pm
yes stdio.h worked
but now it is saying declaration syntax error "namespace std;"
Feb 5, 2011 at 6:11pm
You definitely type the 'using' part, right? FYI, Turbo C++ was been succeeded by C++Builder and support has been discontinued. Consider using a different compiler.
Feb 5, 2011 at 6:12pm
It would be very helpful if you posted your code. Also, what compiler are you using? This definitely sounds like a compiler issue.
Last edited on Feb 5, 2011 at 6:16pm
Feb 5, 2011 at 6:13pm
It may say "Turbo C++", but it is not a C++ compiler. It is an ancient relic from the time before the C++ standard.
Feb 5, 2011 at 6:27pm
Quote from Wikipedia:
Turbo C++ was a C++ compiler and integrated development environment (IDE) originally from Borland.
But I suppose other compilers could be used, but with the Turbo C++ IDE. Does the OP have anything to say about this?
Feb 5, 2011 at 6:40pm
Turbo C++ was a C++ compiler


It was a C++ compiler. Then C++ changed, and now it is not a C++ compiler.
Feb 6, 2011 at 12:46am

Moschops what's the problem there? :)))
Topic archived. No new replies allowed.