Error C2065 Cout Undeclared Identifier

I recently downloaded VC++ and I keep getting this error whenever I try to compile my programs.

I wrote real quick simple program to demonstrate:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <screen.h>

using namespace std;

int main()
{
	int number;
	cout << "Please enter a number.";
	cin >> number;
	if (number < 10)
	{
		cout << "Low";
	}

	else
	{
		cout << "High";
	}
	return 0;
}


When I try to run it I get this:

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\screen.h(56) : error C2065: 'cout' : undeclared identifier
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\screen.h(56) : error C2065: 'flush' : undeclared identifier



Please help!
Try doing it this way around:


1
2
3
#include <iostream>
using namespace std; 
#include <screen.h> //put this AFTER the using namespace directive 


The error messages are referring to lines in your header file. Look there to spot the error.
#include iostream and use namespace std in screen.h.
Topic archived. No new replies allowed.