C++ cout gives undeclared identifier

前端 未结 5 750
闹比i
闹比i 2021-01-18 11:33

So, I have this question. Why does cout throws

error C2065: \'cout\' : undeclared identifier

I am using Visual Studio 2012 as an IDE and I

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-18 11:51

    This error also occurred in the Visual Studio 2017 IDE. Moving stdafx.h to the top solved the error.

    For more on stdafx.h, see What's the use for "stdafx.h" in Visual Studio?

提交回复
热议问题