Error when compiling some simple c++ code
<p>I try to compile this cpp code on osx lion but I get an error.</p>

<pre><code>#include &lt;iostream&gt; 

using namespace std; 

int main (int argc, char *argv[]) 
{ 
    for(int i = 0; i &lt; 10; i++) 
    { 
        cout &lt;&lt; "hi"; 
        cout &lt;&lt; endl; 
    } 

    return 0; 
}
</code></pre>

<p>To compile:</p>

<pre><code>cc main.cpp
</code></pre>

<p>Error:</p>

<pre><code>Undefined symbols for architecture x86_64:
  "std::cout", referenced from:
      _main in ccBdbc76.o
  "std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::operator&lt;&lt; &lt;std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, char const*)", referenced from:
      _main in ccBdbc76.o
  "std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::endl&lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;)", referenced from:
      _main in ccBdbc76.o
  "std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;::operator&lt;&lt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; (*)(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;))", referenced from:
      _main in ccBdbc76.o
  "std::ios_base::Init::Init()", referenced from:
      __static_initialization_and_destruction_0(int, int)in ccBdbc76.o
  "std::ios_base::Init::~Init()", referenced from:
      ___tcf_0 in ccBdbc76.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
</code></pre>
