C++ cout gives undeclared identifier

前端 未结 5 748
闹比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 12:11

    First of all:

    #include 
    

    instead of #include "iostream"

    Secondly, it is generally considered bad practice to write using namespace std;, even though most courses start with that. It is better to only use what you actually need, in your case:

    using std::cout;

提交回复
热议问题