提升库序列化不起作用

时间:2012-08-29 01:20:05

标签: boost

我使用macports来下载并安装boost lib而没有任何问题。

我试图从他们的网站运行代码并得到以下小说:

c ++ -c -o Main.o Main.cpp

...编译

g++  -o VectorSjov Main.o utunity/math/vector/Vec2d.cpp
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:
      bus_stop* boost::archive::detail::load_pointer_type<boost::archive::text_iarchive>::pointer_tweak<bus_stop>(boost::serialization::extended_type_info const&, void const*, bus_stop const&)in Main.o
      bus_route* boost::archive::detail::load_pointer_type<boost::archive::text_iarchive>::pointer_tweak<bus_route>(boost::serialization::extended_type_info const&, void const*, bus_route const&)in Main.o
  "boost::serialization::typeid_system::extended_type_info_typeid_0::type_register(std::type_info const&)", referenced from:
      boost::serialization::extended_type_info_typeid<std::list<bus_stop*, std::allocator<bus_stop*> > >::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_stop_destination>::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<gps_position>::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_stop>::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_stop_corner>::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_route>::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_schedule::trip_info>::extended_type_info_typeid()in Main.o
      ...
  "boost::serialization::typeid_system::extended_type_info_typeid_0::type_unregister()", referenced from:
      boost::serialization::extended_type_info_typeid<std::list<bus_stop*, std::allocator<bus_stop*> > >::~extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_stop_destination>::~extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_stop>::~extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_stop_corner>::~extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_route>::~extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_schedule::trip_info>::~extended_type_info_typeid()in Main.o
      ...
  "boost::serialization::typeid_system::extended_type_info_typeid_0::extended_type_info_typeid_0(char const*)", referenced from:
      boost::serialization::extended_type_info_typeid<std::list<bus_stop*, std::allocator<bus_stop*> > >::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_stop_destination>::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<gps_position>::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_stop>::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_stop_corner>::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_route>::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_schedule::trip_info>::extended_type_info_typeid()in Main.o
      ...
  "boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()", referenced from:
      boost::serialization::extended_type_info_typeid<std::list<bus_stop*, std::allocator<bus_stop*> > >::~extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<std::list<bus_stop*, std::allocator<bus_stop*> > >::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_stop_destination>::~extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_stop_destination>::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<gps_position>::~extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<gps_position>::extended_type_info_typeid()in Main.o
      boost::serialization::extended_type_info_typeid<bus_stop>::~extended_type_info_typeid()in Main.o
      ...
  "boost::serialization::void_downcast(boost::serialization::extended_type_info const&, boost::serialization::extended_type_info const&, void const*)", referenced from:
      void boost::archive::detail::save_pointer_type<boost::archive::text_oarchive>::polymorphic::save<bus_stop>(boost::archive::text_oarchive&, bus_stop&)in Main.o
  "boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)", referenced from:
      void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<unsigned int>(unsigned int&)in Main.o
      void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<boost::serialization::collection_size_type>(boost::serialization::collection_size_type&)in Main.o
      void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<float>(float&)in Main.o
      void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<int>(int&)in Main.o
      void boost::archive::detail::save_pointer_type<boost::archive::text_oarchive>::polymorphic::save<bus_stop>(boost::archive::text_oarchive&, bus_stop&)in Main.o
      void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<unsigned int>(unsigned int const&)in Main.o
      void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<boost::serialization::collection_size_type>(boost::serialization::collection_size_type const&)in Main.o
      ...
  "boost::archive::archive_exception::~archive_exception()", referenced from:
      void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<unsigned int>(unsigned int&)in Main.o
      void boost::serialization::throw_exception<boost::archive::archive_exception>(boost::archive::archive_exception const&)in Main.o
      void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<boost::serialization::collection_size_type>(boost::serialization::collection_size_type&)in Main.o
      void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<float>(float&)in Main.o
      void boost::archive::basic_text_iprimitive<std::basic_istream<char, std::char_traits<char> > >::load<int>(int&)in Main.o
      void boost::archive::detail::save_pointer_type<boost::archive::text_oarchive>::polymorphic::save<bus_stop>(boost::archive::text_oarchive&, bus_stop&)in Main.o
      void boost::archive::basic_text_oprimitive<std::basic_ostream<char, std::char_traits<char> > >::save<unsigned int>(unsigned int const&)in Main.o
      ...
  "boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load_override(boost::archive::class_name_type&, int)", referenced from:
      boost::archive::text_iarchive& boost::archive::detail::interface_iarchive<boost::archive::text_iarchive>::operator>><boost::archive::class_name_type>(boost::archive::class_name_type&)in Main.o
  "boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::load(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)", referenced from:
      void boost::archive::load_access::load_primitive<boost::archive::text_iarchive, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(boost::archive::text_iarchive&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)in Main.o
  "boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::text_iarchive_impl(std::basic_istream<char, std::char_traits<char> >&, unsigned int)", referenced from:
      boost::archive::text_iarchive::text_iarchive(std::basic_istream<char, std::char_traits<char> >&, unsigned int)in Main.o
  "boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(boost::archive::text_oarchive&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in Main.o
  ....

bus_stop_corner>in Main.o
      typeinfo for boost::archive::detail::oserializer<boost::archive::text_oarchive, bus_route>in Main.o
      typeinfo for boost::archive::detail::oserializer<boost::archive::text_oarchive, bus_schedule::trip_info>in Main.o
      ...
  "typeinfo for boost::archive::detail::basic_pointer_iserializer", referenced from:
      typeinfo for boost::archive::detail::pointer_iserializer<boost::archive::text_iarchive, bus_route>in Main.o
      typeinfo for boost::archive::detail::pointer_iserializer<boost::archive::text_iarchive, bus_stop_destination>in Main.o
      typeinfo for boost::archive::detail::pointer_iserializer<boost::archive::text_iarchive, bus_stop_corner>in Main.o
  "typeinfo for boost::archive::detail::basic_pointer_oserializer", referenced from:
      typeinfo for boost::archive::detail::pointer_oserializer<boost::archive::text_oarchive, bus_route>in Main.o
      typeinfo for boost::archive::detail::pointer_oserializer<boost::archive::text_oarchive, bus_stop_destination>in Main.o
      typeinfo for boost::archive::detail::pointer_oserializer<boost::archive::text_oarchive, bus_stop_corner>in Main.o
  "vtable for boost::archive::archive_exception", referenced from:
      boost::archive::archive_exception::archive_exception(boost::archive::archive_exception const&)in Main.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [VectorSjov] Error 1
[Finished in 3.1s with exit code 2]

SERIOUSLY? :d

2 个答案:

答案 0 :(得分:4)

不要忘记链接到提升序列化,它不是仅限标题库。

答案 1 :(得分:0)

> Undefined symbols for architecture x86_64

尝试使用不同的选项进行编译:-m32或-m64