fatal error: iostream: No such file or directory

My first program won't run. it says" fatal error: iostream: No such file or directory".
Can someone help?
Thanks in advance.
Rayson

1
2
3
4
5
6
7
8
9
10
11
 #include <iostream>

using namespace std;

int main ()

{
      cout << "Hey, you I'm Alive! Oh, and Hello World!\n";
cin.get();

}
I don't see any thing wrong with this program you might want

int main( int argc, char* argv[] )

or try and tab over cin.get();

otherwise try :

int y;
cin >> y;
return 0;
> it says" fatal error: iostream: No such file or directory".

Use the C++ compiler. For instance, g++ and not gcc.

From the command line, something like:
> g++ -std=c++11 -Wall -Wextra -pedantic-errors -o my_program.exe my_program.cc 
works fine for me. What compiler are you using?
I am wondering why the cin.get();is there at all. why is it there, when I ran it it my virus protection came up and said it was a threat, but i took the cin statement out and it ran fine no problem at all, so, why, why is it there at all?
Last edited on
> I am wondering why the cin.get();is there at all

To make the program wait till the user types in something. Useful, if the program is run in a new terminal window, and without it the window would close instantly.


> when I ran it it my virus protection came up and said it was a threat,
> but i took the cin statement out and it ran fine no problem at all

Your virus protection is talking through its hat.
Well wouldn't be easier to use a variable? Such as
1
2
3
4
5
6
7
8
9
10
#include <iostream>

using namespace std;

int main()
{
      cout << "Hey, you I'm Alive! Oh, and Hello World!\n";
      int x
      cin >> x;
}


or even

1
2
3
4
5
6
7
8
9
#include <iostream>

using namespace std;

int main()
{
      cout << "Hey, you I'm Alive! Oh, and Hello World!\n";
      system("PAUSE");
}


either of these would work better in my opinion for a beginner programmer
> Well wouldn't be easier to use a variable? Such as

Formatted input (>> into a variable) is required if there could be white space left in the buffer after an earlier formatted input.


> system("PAUSE");

In general, prefer not using std::system() when you have a reasonable alternative. http://www.cplusplus.com/forum/beginner/93213/
I agree, but I'm talking about BEGINNER programming, and a beginner wouldn't need to worry about malicious software in their applications would they? or is there a virus that attacks new .exe's as you create them? or is it sooooo slow that it would be bad for a beginner to learn? I learned it as a beginner and I don't use it anymore so I don't see why not learn it and when it is unnecessary no longer use it, it is not hard to un-learn
Thank you so much everyone. I am using Code blocks 12.11


Still won't compile.....
hey guys, i turns out I missed some basic steps when I start the code block application, now the program runs fine. Thanks again
if I may ask...what was the problem?
> a beginner wouldn't need to worry about malicious software in their applications would they?
> or is there a virus that attacks new .exe's as you create them?
> or is it sooooo slow that it would be bad for a beginner to learn?

Programming is a lot easier if one cultivates good habits. And cultivating good habits early is a lot easier than breaking out of bad habits later. Learning x, unlearning x later, and then learning y is a lot harder than learning y in the first place.
Topic archived. No new replies allowed.