error C2065: ‘cout’ : undeclared identifier

question:

online solution:
1. No

added

#include <iostream>
using namespace std;

or
2. The order of the included libraries needs to be adjusted

//These will not work.
#include <iostream>
using namespace std;
int main () {
    cout << "hey" << endl;
    return 0;
}
#include <iostream>
#include "stdafx.h"
using namespace std;
int main () {
    cout << "hey" << endl;
    return 0;
}
//This will do.

#include "stdafx.h"
#include <iostream>
using namespace std;
int main () {
    cout << "hey" << endl;
    return 0;
}

final solution: my own reasons… Orz)
open iostream file. I commented out part of the code for a project…
just uncomment it.

Read More: