title: Where is cout declared?
body: <p>My computer science professor wants us to find the declaration of <code>cout</code>. I've compiled a simple Hello world program using g++ and the -E parameter. Here's what my hello.cpp looks like:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main(){
  
    string name="";
  
    cout &lt;&lt; "Good morning! What's your name?";
  
    cin &gt;&gt; name;
  
    cout &lt;&lt; "Hello " &lt;&lt; name &lt;&lt; ".\n";
  
    return 0; 
  
  }
  </code></pre>
  
  <p>My compile command:</p>
  
  <pre><code>g++ -E hello.cpp &gt; hello.p
  </code></pre>
  
  <p>In hello.p, I ran a search in VIM, like so:</p>
  
  <pre><code>:/cout
  </code></pre>
  
  <p>I see the following line:</p>
  
  <pre><code>extern ostream cout;
  </code></pre>
  
  <p>Is that the declaration of <code>cout</code>, and is <code>cout</code> an instance of the <code>ostream</code> class?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>What's the <code>wcout</code> declaration there for? If I recall correctly the letter "w" stands for "wide", but I don't know what implication that has. What is a <code>wcout</code> and a <code>wostream</code>?</p>