Ryan94114
asked on
Why does Visual Studio seem to ignore my include file directives?
I'm getting an error in Visual Studio on something that should be very simple.
In the following code, cout is flagged as undefined when I attempt to compile.
I tried <iostream.h>, I tried putting the include in stdafx.h, all to no avail. The compiler keeps telling me that cout is undefined; if I press f12 while selecting cout, it tells me the symbol is defined in iostream.h. But intellisense says cout is undefined and the compiler gives an error indicating cout is undefined.
This is inside a WIN32 Console application. The source code above is the complete contents of test.cpp.
The error message is:
Error 2 error C2065: 'cout' : undeclared identifier
In the following code, cout is flagged as undefined when I attempt to compile.
#include <iostream>
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
cout << "Hello World\n";
return 0;
}
I tried <iostream.h>, I tried putting the include in stdafx.h, all to no avail. The compiler keeps telling me that cout is undefined; if I press f12 while selecting cout, it tells me the symbol is defined in iostream.h. But intellisense says cout is undefined and the compiler gives an error indicating cout is undefined.
This is inside a WIN32 Console application. The source code above is the complete contents of test.cpp.
The error message is:
Error 2 error C2065: 'cout' : undeclared identifier
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
or on ever occurrence of cout use:
Open in new window