error C2065: 'cout' : undeclared identifier

前端 未结 25 2229
误落风尘
误落风尘 2020-12-01 08:40

I am working on the \'driver\' part of my programing assignment and i keep getting this absurd error:

error C2065: \'cout\' : undeclared identifier

25条回答
  •  天涯浪人
    2020-12-01 09:28

    I had the same issue when starting a ms c++ 2010 project from scratch - I removed all of the header files generated by ms and but used:

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

    I had to include stdafx.h as it caused an error not having it in.

提交回复
热议问题