Beginner troubles

I just bought a book on C++, as i am very new to this, only my second day, this might seem incredibly dumb to ask, but ive searched online for the answer and cannot figure it out. I get an error message,
fatal error: iostream: No such file or directory
compilation terminated.
This to be exact, and i cannot figure out how to stop it.

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

using namespace std;

int main()
{
    int mynumber;
    mynumber = 10;
    cout << my number << endl;
    return 0;
}

Heres the code, exactly how it was in the book, but it doesnt work, if someone could help me out, that would be great, thanks!
Line 9 Variable name should be mynumber
not my number
i just changed that, and it still gives me the same error message
David joh, I just tried it on my computer, which has code::blocks with the MinGW compiler, and it worked properly (after adding cin.get (); to stop the screen from disappearing.)
Perhaps you have the wrong compiler? Cheers, Don
PS. The above files are free downloads and work beautifully.

#include <iostream>
using namespace std;

int main()
{
int mynumber;
mynumber = 10;
cout << mynumber << endl;
cin.get(); //To stop screen flashing off
return 0;
}
fatal error: iostream: No such file or directory

Your compiler does not find file named "iostream" from the folders that it is looking from. That file should be included with the compiler.

What compiler & OS & ... are you using?
Last edited on
Topic archived. No new replies allowed.