Header File Issues

1
2
3
4
5
6
#include <iostream.h> //"iostream.h" also doesn't work
main()
     {
     cout >> "test";
     return 0;
     }


What's wrong you ask? Nothing, exept the fact that any program I run with a Header file will say "Unable to open ... header file".

Is it my version of the Compiler?
Is it locations of the Header files?

I do have a disk in the drive. I do have the iostream header file in the disk and on my computer. The problem occurs with every header file attempted to head.

Any answers, ideas, comments, suggestions, concerns, problems, cookies, please post here or email me at [removed] or [removed].

Thanks!
Last edited on by admin
use <iostream> not <iostream.h>

and int main() not main()

and include using namespace std;

and its cout << not cout >>
Last edited on
I realize this with the cout thing. I tried the <iostream> not <iostream.h>.

By the by, what is "namespace std"?

I just started a month ago. I read a 750 page book on it (the text was big, for some reason). I couldn't try anything in the book.
All definitions in the standard library (of which iostream is a part) are inside the namespace std. using namespace std; tells the compiler anything you use is possibly located in the std namespace. Instead of doing this, you could use std::cout, adding std:: in front of anything you use that is in the standard library.
Can someone explain or use a program that uses std?
Last edited on
Your program at the top of the page uses std::cout (or at least it wants to)
Maybe you should read some parts of the tutorial on this site. 750 pages and nothing to try...? Maybe it wasnt ment for starters?
I think you're using an old book. read some tutorials here and get yourself a decent Compiler + IDE (Code::Blocks and MingW is what i recommend).

Here's the program you want to run:
#include<iostream>

int main()
{
std::cout<<"Hello world!"<<std::endl;
return 0;
}

if the a console window just flashes on the screen stick a std::cin.get() before return 0;
Topic archived. No new replies allowed.