Почему не может цепляться с libc ++ в ссылке в режиме C ++ 0x? этот пример boost :: program_options?

Компиляция этого примера кода для boost :: program_options: http://svn.boost.org/svn/boost/trunk/ libs / program_options / example / first.cpp

... в MacOS Lion (10.7.2) с использованием boost-1.48.0, установленного с MacPorts:

$ 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, std::__1::allocator > const&, unsigned int, unsigned int)", referenced from:
      _main in cc-6QQcwm.o
  "boost::program_options::operator<<(std::__1::basic_ostream >&, boost::program_options::options_description const&)", referenced from:
      _main in cc-6QQcwm.o
  "boost::program_options::abstract_variables_map::operator[](std::__1::basic_string, std::__1::allocator > const&) const", referenced from:
      boost::program_options::variables_map::operator[](std::__1::basic_string, std::__1::allocator > const&) const in cc-6QQcwm.o
  "boost::program_options::detail::cmdline::set_additional_parser(boost::function1, std::__1::allocator >, std::__1::basic_string, std::__1::allocator > >, std::__1::basic_string, std::__1::allocator > const&>)", referenced from:
      boost::program_options::basic_command_line_parser::extra_parser(boost::function1, std::__1::allocator >, std::__1::basic_string, std::__1::allocator > >, std::__1::basic_string, std::__1::allocator > const&>) in cc-6QQcwm.o
  "boost::program_options::detail::cmdline::cmdline(std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > > const&)", referenced from:
      boost::program_options::basic_command_line_parser::basic_command_line_parser(int, char const* const*) in cc-6QQcwm.o
  "boost::program_options::to_internal(std::__1::basic_string, std::__1::allocator > const&)", referenced from:
      std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > > boost::program_options::to_internal, std::__1::allocator > >(std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > > const&) in cc-6QQcwm.o
  "boost::program_options::invalid_option_value::invalid_option_value(std::__1::basic_string, std::__1::allocator > const&)", referenced from:
      void boost::program_options::validate(boost::any&, std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > > const&, int*, long) in cc-6QQcwm.o
  "boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&)", referenced from:
      std::__1::basic_string, std::__1::allocator > const& boost::program_options::validators::get_single_string(std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > > const&, bool) in cc-6QQcwm.o
  "boost::program_options::value_semantic_codecvt_helper::parse(boost::any&, std::__1::vector, std::__1::allocator >, std::__1::allocator, std::__1::allocator > > > const&, bool) const", referenced from:
      vtable for boost::program_options::typed_value 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)

Тот же код, скомпилированный / связанный с g ++ 4.7, установленным с MacPorts:

$ g++-mp-4.7 -std=c++0x -I/opt/local/include -L/opt/local/lib -lboost_program_options -o first first.cpp

... отлично работает. Как и использование clang без libc ++:

clang++ -std=c++0x -I/opt/local/include -L/opt/local/lib -lboost_program_options first.cpp -o first

Что не так? Почему boost :: program_options и libc ++ не работают вместе?

64
задан x-x 10 December 2011 в 12:29
поделиться