0

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]

真剣に?:D

4

2 に答える 2

4

シリアル化を促進するためにリンクすることを忘れないでください。これはヘッダーのみのライブラリではありません。

于 2013-03-20T19:54:26.423 に答える
0
> Undefined symbols for architecture x86_64

別のオプションでコンパイルしてみてください: -m32 または -m64

于 2012-08-29T07:31:39.060 に答える