title: Why can't I view cout in debug watch window in Visual Studio?
body: <p>While I run this in VS:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;sstream&gt;
  using namespace std;
  int main(int args, char *argv[])
  {
      ostringstream local;
      auto cout_buff = cout.rdbuf();
      cout.rdbuf(local.rdbuf());
      cout &lt;&lt; "some message";
      cout.rdbuf(cout_buff);
      cout &lt;&lt; "back to default buffer\n";
      cout &lt;&lt; "local contetn:" &lt;&lt; local.str() &lt;&lt; endl;
  } 
  </code></pre>
  
  <p>I wanna see how <code>cout</code> internally changes, trying to add <code>cout</code> in <em>Watch Window</em>, but I got <code>identifier "cout" is undefined</code>. How come?</p>
  
  <p><a href="https://i.stack.imgur.com/5kiR9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5kiR9.png" alt="enter image description here"></a></p>