title: Why can't clang with libc++ in c++0x mode link this boost::program_options example?
body: <p>Compiling this example code for boost::program_options: <a href="http://svn.boost.org/svn/boost/trunk/libs/program_options/example/first.cpp" rel="noreferrer">http://svn.boost.org/svn/boost/trunk/libs/program_options/example/first.cpp</a></p>
  
  <p>...on MacOS Lion (10.7.2), using boost-1.48.0 installed with MacPorts:</p>
  
  <pre><code>$ clang++ -v
  Apple clang version 3.0 (tags/Apple/clang-211.12) (based on LLVM 3.0svn)
  Target: x86_64-apple-darwin11.2.0
  Thread model: posix
  $ clang++ -std=c++0x --stdlib=libc++ -lc++ -I/opt/local/include -L/opt/local/lib -lboost_program_options first.cpp -o first
  Undefined symbols for architecture x86_64:
    "boost::program_options::options_description::options_description(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, unsigned int, unsigned int)", referenced from:
        _main in cc-6QQcwm.o
    "boost::program_options::operator&lt;&lt;(std::__1::basic_ostream&lt;char, std::__1::char_traits&lt;char&gt; &gt;&amp;, boost::program_options::options_description const&amp;)", referenced from:
        _main in cc-6QQcwm.o
    "boost::program_options::abstract_variables_map::operator[](std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;) const", referenced from:
        boost::program_options::variables_map::operator[](std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;) const in cc-6QQcwm.o
    "boost::program_options::detail::cmdline::set_additional_parser(boost::function1&lt;std::__1::pair&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;&gt;)", referenced from:
        boost::program_options::basic_command_line_parser&lt;char&gt;::extra_parser(boost::function1&lt;std::__1::pair&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;&gt;) in cc-6QQcwm.o
    "boost::program_options::detail::cmdline::cmdline(std::__1::vector&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::allocator&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;)", referenced from:
        boost::program_options::basic_command_line_parser&lt;char&gt;::basic_command_line_parser(int, char const* const*) in cc-6QQcwm.o
    "boost::program_options::to_internal(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;)", referenced from:
        std::__1::vector&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::allocator&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt; &gt; boost::program_options::to_internal&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt;(std::__1::vector&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::allocator&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;) in cc-6QQcwm.o
    "boost::program_options::invalid_option_value::invalid_option_value(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;)", referenced from:
        void boost::program_options::validate&lt;int, char&gt;(boost::any&amp;, std::__1::vector&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::allocator&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, int*, long) in cc-6QQcwm.o
    "boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;)", referenced from:
        std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp; boost::program_options::validators::get_single_string&lt;char&gt;(std::__1::vector&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::allocator&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, bool) in cc-6QQcwm.o
    "boost::program_options::value_semantic_codecvt_helper&lt;char&gt;::parse(boost::any&amp;, std::__1::vector&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, std::__1::allocator&lt;std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; &gt; &gt; const&amp;, bool) const", referenced from:
        vtable for boost::program_options::typed_value&lt;int, char&gt; in cc-6QQcwm.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>The same code compiled/linked with g++4.7 installed with MacPorts:</p>
  
  <pre><code>$ g++-mp-4.7 -std=c++0x -I/opt/local/include -L/opt/local/lib -lboost_program_options -o first first.cpp
  </code></pre>
  
  <p>... works fine. As does using clang without libc++:</p>
  
  <pre><code>clang++ -std=c++0x -I/opt/local/include -L/opt/local/lib -lboost_program_options first.cpp -o first
  </code></pre>
  
  <p>What's wrong? Why does boost::program_options and libc++ not work together?</p>