如何编译Shark C ++ Library提供的示例程序?

时间:2016-09-26 17:40:14

标签: c++

我正在运行OSX ELCapitan。

我安装了鲨鱼:

brew install shark --c++11

我在安装shark之​​前安装了boost和cmake。

此外,我已经下载了Shark源代码并使用

进行构建
cmake
make

然后如果我尝试编译:

g++ -L/usr/lib -lcblas -L/usr/local/Cellar/shark/3.1.3/lib -lshark -std=c++11 quickstartTutorial.cpp

我收到错误(http://pastebin.com/qV4Vv3XZ):

Undefined Symbols for architecture x86_64:
  "boost::serialization::void_upcast(boost::serialization::extended_type_info const&, boost::serialization::extended_type_info const&, void const*)", referenced from:
      shark::blas::vector<double>* boost::archive::detail::load_pointer_type<boost::archive::polymorphic_iarchive>::pointer_tweak<shark::blas::vector<double> >(boost::serialization::extended_type_info const&, void const*, shark::blas::vector<double> const&) in quickstartTutorial-fdfbd1.o
      shark::blas::matrix<double, shark::blas::row_major>* boost::archive::detail::load_pointer_type<boost::archive::polymorphic_iarchive>::pointer_tweak<shark::blas::matrix<double, shark::blas::row_major> >(boost::serialization::extended_type_info const&, void const*, shark::blas::matrix<double, shark::blas::row_major> const&) in quickstartTutorial-fdfbd1.o

      ...
  "boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()", referenced from:
      boost::serialization::extended_type_info_typeid<shark::blas::vector<double> >::extended_type_info_typeid() in quickstartTutorial-fdfbd1.o
      boost::serialization::extended_type_info_typeid<shark::blas::vector<double> >::~extended_type_info_typeid() in quickstartTutorial-fdfbd1.o
      boost::serialization::extended_type_info_typeid<std::__1::vector<boost::shared_ptr<shark::blas::vector<double> >, std::__1::allocator<boost::shared_ptr<shark::blas::vector<double> > > > >::extended_type_info_typeid() in quickstartTutorial-fdfbd1.o
      boost::serialization::extended_type_info_typeid<std::__1::vector<boost::shared_ptr<shark::blas::vector<double> >, std::__1::allocator<boost::shared_ptr<shark::blas::vector<double> > > > >::~extended_type_info_typeid() in quickstartTutorial-fdfbd1.o
      boost::serialization::extended_type_info_typeid<boost::shared_ptr<shark::blas::vector<double> > >::extended_type_info_typeid() in quickstartTutorial-fdfbd1.o
      boost::serialization::extended_type_info_typeid<boost::shared_ptr<shark::blas::vector<double> > >::~extended_type_info_typeid() in quickstartTutorial-fdfbd1.o
      boost::serialization::extended_type_info_typeid<shark::detail::SharedContainer<double> >::extended_type_info_typeid() in quickstartTutorial-fdfbd1.o
      ...
  "boost::serialization::void_downcast(boost::serialization::extended_type_info const&, boost::serialization::extended_type_info const&, void const*)", referenced from:
      boost::serialization::void_downcast(boost::serialization::extended_type_info const&, boost::serialization::extended_type_info const&, void*) in quickstartTutorial-fdfbd1.o
      void boost::serialization::shared_ptr_helper<boost::shared_ptr>::reset<shark::blas::vector<int> >(boost::shared_ptr<shark::blas::vector<int> >&, shark::blas::vector<int>*) in libshark.a(Csv.cpp.o)
      void boost::serialization::shared_ptr_helper<boost::shared_ptr>::reset<shark::blas::vector<float> >(boost::shared_ptr<shark::blas::vector<float> >&, shark::blas::vector<float>*) in libshark.a(Csv.cpp.o)
      void boost::serialization::shared_ptr_helper<boost::shared_ptr>::reset<shark::blas::vector<double> >(boost::shared_ptr<shark::blas::vector<double> >&, shark::blas::vector<double>*) in libshark.a(Csv.cpp.o)
      void boost::serialization::shared_ptr_helper<boost::shared_ptr>::reset<shark::blas::matrix<double, shark::blas::row_major> >(boost::shared_ptr<shark::blas::matrix<double, shark::blas::row_major> >&, shark::blas::matrix<double, shark::blas::row_major>*) in libshark.a(Csv.cpp.o)
      void 
      shark::blas::vector<double>* boost::archive::detail::load_pointer_type<boost::archive::polymorphic_iarchive>::pointer_tweak<shark::blas::vector<double> >(boost::serialization::extended_type_info const&, void const*, shark::blas::vector<double> const&) in quickstartTutorial-fdfbd1.o
      void boost::serialization::throw_exception<boost::archive::archive_exception>(boost::archive::archive_exception const&) in quickstartTutorial-fdfbd1.o
      void boost::serialization::shared_ptr_helper<boost::shared_ptr>::reset<shark::blas::matrix<double, shark::blas::row_major> >(boost::shared_ptr<shark::blas::matrix<double, shark::blas::row_major> >&, shark::blas::matrix<double, shark::blas::row_major>*) in quickstartTutorial-fdfbd1.o
      shark::blas::matrix<double, shark::blas::row_major>* boost::archive::detail::load_pointer_type<boost::archive::polymorphic_iarchive>::pointer_tweak<shark::blas::matrix<double, shark::blas::row_major> >(boost::serialization::extended_type_info const&, void const*, shark::blas::matrix<double, shark::blas::row_major> const&) in quickstartTutorial-fdfbd1.o
      void boost::serialization::shared_ptr_helper<boost::shared_ptr>::reset<shark::blas::vector<unsigned int> >(boost::shared_ptr<shark::blas::vector<unsigned int> >&, shark::blas::vector<unsigned int>*) in quickstartTutorial-fdfbd1.o
      shark::blas::vector<unsigned int>* boost::archive::detail::load_pointer_type<boost::archive::polymorphic_iarchive>::pointer_tweak<shark::blas::vector<unsigned int> >(boost::serialization::extended_type_info const&, void const*, shark::blas::vector<unsigned int> const&) in quickstartTutorial-fdfbd1.o
      ...
  "boost::archive::detail::basic_iarchive::next_object_pointer(void*)", referenced from:
      boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<double> >::load_object_ptr(boost::archive::detail::basic_iarchive&, void*, unsigned int) const in quickstartTutorial-fdfbd1.o
      boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::matrix<double, shark::blas::row_major> >::load_object_ptr(boost::archive::detail::basic_iarchive&, void*, unsigned int) const in quickstartTutorial-fdfbd1.o
      boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<unsigned int> >::load_object_ptr(boost::archive::detail::basic_iarchive&, void*, unsigned int) const in quickstartTutorial-fdfbd1.o
      boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<int> >::load_object_ptr(boost::archive::detail::basic_iarchive&, void*, unsigned int) const in libshark.a(Csv.cpp.o)
      boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<float> >::load_object_ptr(boost::archive::detail::basic_iarchive&, void*, unsigned int) const in libshark.a(Csv.cpp.o)
      boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<double> >::load_object_ptr(boost::archive::detail::basic_iarchive&, void*, unsigned int) const in libshark.a(Csv.cpp.o)
      boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::matrix<double, shark::blas::row_major> >::load_object_ptr(boost::archive::detail::basic_iarchive&, void*, unsigned int) const in libshark.a(Csv.cpp.o)
      ...
  "boost::archive::detail::basic_iserializer::basic_iserializer(boost::serialization::extended_type_info const&)", referenced from:
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<double> >::iserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, std::__1::vector<boost::shared_ptr<shark::blas::vector<double> >, std::__1::allocator<boost::shared_ptr<shark::blas::vector<double> > > > >::iserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, boost::shared_ptr<shark::blas::vector<double> > >::iserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, shark::detail::SharedContainer<double> >::iserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, shark::LabeledData<shark::blas::vector<double>, unsigned int> >::iserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, shark::Data<double> >::iserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, std::__1::vector<boost::shared_ptr<shark::blas::matrix<double, shark::blas::row_major> >, std::__1::allocator<boost::shared_ptr<shark::blas::matrix<double, shark::blas::row_major> > > > >::iserializer() in quickstartTutorial-fdfbd1.o
      ...
  "boost::archive::detail::basic_iserializer::~basic_iserializer()", referenced from:
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<double> >::~iserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, std::__1::vector<boost::shared_ptr<shark::blas::vector<double> >, std::__1::allocator<boost::shared_ptr<shark::blas::vector<double> > > > >::~iserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, boost::shared_ptr<shark::blas::vector<double> > >::~iserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, shark::detail::SharedContainer<double> >::~iserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, shark::LabeledData<shark::blas::vector<double>, unsigned int> >::~iserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, shark::Data<double> >::~iserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, std::__1::vector<boost::shared_ptr<shark::blas::matrix<double, shark::blas::row_major> >, std::__1::allocator<boost::shared_ptr<shark::blas::matrix<double, shark::blas::row_major> > > > >::~iserializer() in quickstartTutorial-fdfbd1.o
      ...
  "boost::archive::detail::basic_oserializer::basic_oserializer(boost::serialization::extended_type_info const&)", referenced from:
      boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive, shark::blas::vector<double> >::oserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive, std::__1::vector<boost::shared_ptr<shark::blas::vector<double> >, std::__1::allocator<boost::shared_ptr<shark::blas::vector<double> > > > >::oserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive, boost::shared_ptr<shark::blas::vector<double> > >::oserializer() in quickstartTutorial-fdfbd1.o
      boost::archive::detail::pointer_oserializer<boost::archive::polymorphic_oarchive, shark::blas::matrix<double, shark::blas::row_major> >::pointer_oserializer() in libshark.a(Csv.cpp.o)
      ...
  "boost::archive::detail::basic_pointer_iserializer::basic_pointer_iserializer(boost::serialization::extended_type_info const&)", referenced from:
      boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<double> >::pointer_iserializer() in quickstartTutorial-fdfbd1.o
      boost::serialization::smart_cast_impl::reference<boost::archive::polymorphic_iarchive&>::polymorphic::cross::cast<boost::archive::detail::basic_iarchive>(boost::archive::detail::basic_iarchive&) in libshark.a(LDA.cpp.o)
  "typeinfo for boost::archive::detail::basic_oarchive", referenced from:
      boost::archive::polymorphic_oarchive& boost::serialization::smart_cast_impl::reference<boost::archive::polymorphic_oarchive&>::polymorphic::cross::cast<boost::archive::detail::basic_oarchive>(boost::archive::detail::basic_oarchive&) in quickstartTutorial-fdfbd1.o
      boost::archive::detail::basic_oarchive& boost::serialization::smart_cast_impl::reference<boost::archive::detail::basic_oarchive&>::polymorphic::cross::cast<boost::archive::polymorphic_oarchive>(boost::archive::polymorphic_oarchive&) in quickstartTutorial-fdfbd1.o
      boost::archive::polymorphic_oarchive& boost::serialization::smart_cast_impl::reference<boost::archive::polymorphic_oarchive&>::polymorphic::cross::cast<boost::archive::detail::basic_oarchive>(boost::archive::detail::basic_oarchive&) in libshark.a(Csv.cpp.o)
      boost::archive::detail::basic_oarchive& boost::serialization::smart_cast_impl::reference<boost::archive::detail::basic_oarchive&>::polymorphic::cross::cast<boost::archive::polymorphic_oarchive>(boost::archive::polymorphic_oarchive&) in libshark.a(Csv.cpp.o)
      boost::archive::polymorphic_oarchive& boost::serialization::smart_cast_impl::reference<boost::archive::polymorphic_oarchive&>::polymorphic::cross::cast<boost::archive::detail::basic_oarchive>(boost::archive::detail::basic_oarchive&) in libshark.a(LDA.cpp.o)
      boost::archive::detail::basic_oarchive& boost::serialization::smart_cast_impl::reference<boost::archive::detail::basic_oarchive&>::polymorphic::cross::cast<boost::archive::polymorphic_oarchive>(boost::archive::polymorphic_oarchive&) in libshark.a(LDA.cpp.o)
  "typeinfo for boost::archive::detail::basic_iserializer", referenced from:
      typeinfo for boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<double> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, std::__1::vector<boost::shared_ptr<shark::blas::vector<double> >, std::__1::allocator<boost::shared_ptr<shark::blas::vector<double> > > > > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, boost::shared_ptr<shark::blas::vector<double> > > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, shark::detail::SharedContainer<double> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, shark::LabeledData<shark::blas::vector<double>, unsigned int> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, shark::Data<double> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::iserializer<boost::archive::polymorphic_iarchive, std::__1::vector<boost::shared_ptr<shark::blas::matrix<double, shark::blas::row_major> >, std::__1::allocator<boost::shared_ptr<shark::blas::matrix<double, shark::blas::row_major> > > > > in quickstartTutorial-fdfbd1.o
      ...
  "typeinfo for boost::archive::detail::basic_oserializer", referenced from:
      typeinfo for boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive, shark::blas::vector<double> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive, std::__1::vector<boost::shared_ptr<shark::blas::vector<double> >, std::__1::allocator<boost::shared_ptr<shark::blas::vector<double> > > > > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive, boost::shared_ptr<shark::blas::vector<double> > > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive, shark::detail::SharedContainer<double> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive, shark::LabeledData<shark::blas::vector<double>, unsigned int> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive, shark::Data<double> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive, std::__1::vector<boost::shared_ptr<shark::blas::matrix<double, shark::blas::row_major> >, std::__1::allocator<boost::shared_ptr<shark::blas::matrix<double, shark::blas::row_major> > > > > in quickstartTutorial-fdfbd1.o
      ...
  "typeinfo for boost::archive::detail::basic_pointer_iserializer", referenced from:
      typeinfo for boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<double> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::matrix<double, shark::blas::row_major> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<unsigned int> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<int> > in libshark.a(Csv.cpp.o)
      typeinfo for boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<float> > in libshark.a(Csv.cpp.o)
      typeinfo for boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::vector<double> > in libshark.a(Csv.cpp.o)
      typeinfo for boost::archive::detail::pointer_iserializer<boost::archive::polymorphic_iarchive, shark::blas::matrix<double, shark::blas::row_major> > in libshark.a(Csv.cpp.o)
      ...
  "typeinfo for boost::archive::detail::basic_pointer_oserializer", referenced from:
      typeinfo for boost::archive::detail::pointer_oserializer<boost::archive::polymorphic_oarchive, shark::blas::vector<double> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::pointer_oserializer<boost::archive::polymorphic_oarchive, shark::blas::matrix<double, shark::blas::row_major> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::pointer_oserializer<boost::archive::polymorphic_oarchive, shark::blas::vector<unsigned int> > in quickstartTutorial-fdfbd1.o
      typeinfo for boost::archive::detail::pointer_oserializer<boost::archive::polymorphic_oarchive, shark::blas::vector<int> > in libshark.a(Csv.cpp.o)
      typeinfo for boost::archive::detail::pointer_oserializer<boost::archive::polymorphic_oarchive, shark::blas::vector<float> > in libshark.a(Csv.cpp.o)
      typeinfo for boost::archive::detail::pointer_oserializer<boost::archive::polymorphic_oarchive, shark::blas::vector<double> > in libshark.a(Csv.cpp.o)
      typeinfo for boost::archive::detail::pointer_oserializer<boost::archive::polymorphic_oarchive, shark::blas::matrix<double, shark::blas::row_major> > in libshark.a(Csv.cpp.o)
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

非常感谢任何帮助。

非常感谢。

0 个答案:

没有答案