title: How can I resolve missing symbols when compiling C++ code with clang 2.8 on Mac OS X 10.6?
body: <p>The following code, compiled on OS X with clang 2.8 from macports gives the missing symbol errors below.</p>
  
  <pre><code>   #include &lt;iostream&gt;
  
     int main()
     {
       std::cout &lt;&lt; "hello world" &lt;&lt; std::endl;
     }
  
  
  jonathancoe@MacBookCoe:/tmp$ clang HW.cpp 
  Undefined symbols:
    "__ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc", referenced from:
        _main in cc-C9ObsA.o
    "__ZNSt8ios_base4InitC1Ev", referenced from:
        ___cxx_global_var_init in cc-C9ObsA.o
    "__ZNSt8ios_base4InitD1Ev", referenced from:
        ___cxx_global_var_init in cc-C9ObsA.o
    "__ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_", referenced from:
        _main in cc-C9ObsA.o
    "__ZNSolsEPFRSoS_E", referenced from:
        _main in cc-C9ObsA.o
    "__ZSt4cout", referenced from:
        _main in cc-C9ObsA.o
  ld: symbol(s) not found
  </code></pre>
  
  <p>The simple program links fine using g++ without any extra arguments. Any ideas what I can do to get this program to link or explanations as to why it is not possible (if that is the case)?</p>