error C2065: 'cout' : undeclared identifier

前端 未结 25 2148
误落风尘
误落风尘 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:38

    The code below compiles and runs properly for me using gcc. Try copy/pasting this and see if it works.

    #include 
    using namespace std;
    
    int bob (int a) { cout << "hey" << endl; return 0; };
    
    int main () {
        int a = 1;
        bob(a);
        return 0;
    }
    

提交回复
热议问题