[Serialization] Failed to Link "A Very Simple Case"
Dear all,
Trying the first example of the Boost.Serialization (A Very Simple Case):
http://boost-sandbox.sourceforge.net/boost_1_43_0/libs/serialization/doc/tut...
I get the error messages in the P.S. section with GCC 4.4.0 MinGW WinXP. Any ideas?
TIA,
--Hossein
P.S.
Compiling: main.cpp
Linking console executable: bin\Debug\Serial.exe
obj\Debug\main.o: In function `text_oarchive':
/archive/text_oarchive.hpp:92: undefined reference to `boost::archive::text_oarchive_implboost::archive::text_oarchive::text_oarchive_impl(std::ostream&, unsigned int)'
obj\Debug\main.o: In function `text_iarchive':
/archive/text_iarchive.hpp:129: undefined reference to `boost::archive::text_iarchive_implboost::archive::text_iarchive::text_iarchive_impl(std::istream&, unsigned int)'
/archive/text_iarchive.hpp:129: undefined reference to `boost::archive::detail::shared_ptr_helper::shared_ptr_helper()'
obj\Debug\main.o: In function `~text_iarchive':
/archive/text_iarchive.hpp:131: undefined reference to `boost::archive::detail::shared_ptr_helper::~shared_ptr_helper()'
/archive/text_iarchive.hpp:131: undefined reference to `boost::archive::detail::shared_ptr_helper::~shared_ptr_helper()'
obj\Debug\main.o: In function `~text_oarchive_impl':
/archive/text_oarchive.hpp:77: undefined reference to `boost::archive::basic_text_oprimitivestd::ostream::~basic_text_oprimitive()'
/archive/text_oarchive.hpp:77: undefined reference to `boost::archive::basic_text_oprimitivestd::ostream::~basic_text_oprimitive()'
/archive/text_oarchive.hpp:77: undefined reference to `boost::archive::basic_text_oprimitivestd::ostream::~basic_text_oprimitive()'
/archive/text_oarchive.hpp:77: undefined reference to `boost::archive::basic_text_oprimitivestd::ostream::~basic_text_oprimitive()'
/archive/text_oarchive.hpp:77: undefined reference to `boost::archive::basic_text_oprimitivestd::ostream::~basic_text_oprimitive()'
obj\Debug\main.o:
/archive/text_oarchive.hpp:77: more undefined references to `boost::archive::basic_text_oprimitivestd::ostream::~basic_text_oprimitive()' follow
obj\Debug\main.o: In function `~text_iarchive_impl':
/archive/text_iarchive.hpp:80: undefined reference to `boost::archive::basic_text_iprimitivestd::istream::~basic_text_iprimitive()'
/archive/text_iarchive.hpp:80: undefined reference to `boost::archive::basic_text_iprimitivestd::istream::~basic_text_iprimitive()'
/archive/text_iarchive.hpp:80: undefined reference to `boost::archive::basic_text_iprimitivestd::istream::~basic_text_iprimitive()'
/archive/text_iarchive.hpp:80: undefined reference to `boost::archive::basic_text_iprimitivestd::istream::~basic_text_iprimitive()'
/archive/text_iarchive.hpp:80: undefined reference to `boost::archive::basic_text_iprimitivestd::istream::~basic_text_iprimitive()'
obj\Debug\main.o:
/archive/text_iarchive.hpp:80: more undefined references to `boost::archive::basic_text_iprimitivestd::istream::~basic_text_iprimitive()' follow
obj\Debug\main.o: In function `~common_oarchive':
archive/detail/common_oarchive.hpp:38: undefined reference to `boost::archive::detail::basic_oarchive::~basic_oarchive()'
/archive/detail/common_oarchive.hpp:38: undefined reference to `boost::archive::detail::basic_oarchive::~basic_oarchive()'
/archive/detail/common_oarchive.hpp:38: undefined reference to `boost::archive::detail::basic_oarchive::~basic_oarchive()'
obj\Debug\main.o: In function `~common_iarchive':
/archive/detail/common_iarchive.hpp:43: undefined reference to `boost::archive::detail::basic_iarchive::~basic_iarchive()'
/archive/detail/common_iarchive.hpp:43: undefined reference to `boost::archive::detail::basic_iarchive::~basic_iarchive()'
/archive/detail/common_iarchive.hpp:43: undefined reference to `boost::archive::detail::basic_iarchive::~basic_iarchive()'
obj\Debug\main.o:
/archive/detail/oserializer.hpp:253: undefined reference to `boost::archive::detail::basic_oarchive::save_object(void const*, boost::archive::detail::basic_oserializer const&)'
obj\Debug\main.o:
/archive/detail/iserializer.hpp:381: undefined reference to `boost::archive::detail::basic_iarchive::load_object(void*, boost::archive::detail::basic_iserializer const&)'
obj\Debug\main.o: In function `oserializer':
/archive/detail/oserializer.hpp:112: undefined reference to `boost::archive::detail::basic_oserializer::basic_oserializer(boost::serialization::extended_type_info const&)'
obj\Debug\main.o: In function `~oserializer':
/archive/detail/oserializer.hpp:133: undefined reference to `boost::archive::detail::basic_oserializer::~basic_oserializer()'
/archive/detail/oserializer.hpp:133: undefined reference to `boost::archive::detail::basic_oserializer::~basic_oserializer()'
/archive/detail/oserializer.hpp:133: undefined reference to `boost::archive::detail::basic_oserializer::~basic_oserializer()'
obj\Debug\main.o: In function `iserializer':
/archive/detail/iserializer.hpp:133: undefined reference to `boost::archive::detail::basic_iserializer::basic_iserializer(boost::serialization::extended_type_info const&)'
obj\Debug\main.o: In function `~iserializer':
/archive/detail/iserializer.hpp:158: undefined reference to `boost::archive::detail::basic_iserializer::~basic_iserializer()'
/archive/detail/iserializer.hpp:158: undefined reference to `boost::archive::detail::basic_iserializer::~basic_iserializer()'
/archive/detail/iserializer.hpp:158: undefined reference to `boost::archive::detail::basic_iserializer::~basic_iserializer()'
obj\Debug\main.o: In function `extended_type_info_typeid':
/serialization/extended_type_info_typeid.hpp:86: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::extended_type_info_typeid_0(char const*)'
/serialization/extended_type_info_typeid.hpp:88: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::type_register(std::type_info const&)'
/serialization/extended_type_info_typeid.hpp:89: undefined reference to `boost::serialization::extended_type_info::key_register() const'
/serialization/extended_type_info_typeid.hpp:89: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
obj\Debug\main.o: In function `~extended_type_info_typeid':
/serialization/extended_type_info_typeid.hpp:92: undefined reference to `boost::serialization::extended_type_info::key_unregister() const'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::type_unregister()'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
/serialization/extended_type_info_typeid.hpp:92: undefined reference to `boost::serialization::extended_type_info::key_unregister() const'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::type_unregister()'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
/serialization/extended_type_info_typeid.hpp:92: undefined reference to `boost::serialization::extended_type_info::key_unregister() const'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::type_unregister()'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
obj\Debug\main.o:main.cpp:(.rdata$_ZTVN5boost13serialization6detail17singleton_wrapperINS0_25extended_type_info_typeidI12gps_positionEEEE[vtable for boost::serialization::detail::singleton_wrapper
Hossein Haeri wrote:
Dear all,
Trying the first example of the Boost.Serialization (A Very Simple Case):
http://boost-sandbox.sourceforge.net/boost_1_43_0/libs/serialization/doc/tut...
I get the error messages in the P.S. section with GCC 4.4.0 MinGW WinXP. Any ideas?
Does http://vladimir_prus.blogspot.com/2009/06/linking-101.html help? - Volodya
Dear Volodya,
Does
http://vladimir_prus.blogspot.com/2009/06/linking-101.html
help?
Nope. Because (using some automatic tools), I DO know that most of those member functions that the error messages in the P.S. mentions are not implemented in my respective Boost.Serialization directory. Might that be because Serialization needs some form of pre-use build? Or, am I missing something else?
TIA,
--Hossein
P.S.
P.S.
Compiling: main.cpp
Linking console executable: bin\Debug\Serial.exe
obj\Debug\main.o: In function `text_oarchive':
/archive/text_oarchive.hpp:92: undefined reference to `boost::archive::text_oarchive_implboost::archive::text_oarchive::text_oarchive_impl(std::ostream&, unsigned int)'
obj\Debug\main.o: In function `text_iarchive':
/archive/text_iarchive.hpp:129: undefined reference to `boost::archive::text_iarchive_implboost::archive::text_iarchive::text_iarchive_impl(std::istream&, unsigned int)'
/archive/text_iarchive.hpp:129: undefined reference to `boost::archive::detail::shared_ptr_helper::shared_ptr_helper()'
obj\Debug\main.o: In function `~text_iarchive':
/archive/text_iarchive.hpp:131: undefined reference to `boost::archive::detail::shared_ptr_helper::~shared_ptr_helper()'
/archive/text_iarchive.hpp:131: undefined reference to `boost::archive::detail::shared_ptr_helper::~shared_ptr_helper()'
obj\Debug\main.o: In function `~text_oarchive_impl':
/archive/text_oarchive.hpp:77: undefined reference to `boost::archive::basic_text_oprimitivestd::ostream::~basic_text_oprimitive()'
/archive/text_oarchive.hpp:77: undefined reference to `boost::archive::basic_text_oprimitivestd::ostream::~basic_text_oprimitive()'
/archive/text_oarchive.hpp:77: undefined reference to `boost::archive::basic_text_oprimitivestd::ostream::~basic_text_oprimitive()'
/archive/text_oarchive.hpp:77: undefined reference to `boost::archive::basic_text_oprimitivestd::ostream::~basic_text_oprimitive()'
/archive/text_oarchive.hpp:77: undefined reference to `boost::archive::basic_text_oprimitivestd::ostream::~basic_text_oprimitive()'
obj\Debug\main.o:
/archive/text_oarchive.hpp:77: more undefined references to `boost::archive::basic_text_oprimitivestd::ostream::~basic_text_oprimitive()' follow
obj\Debug\main.o: In function `~text_iarchive_impl':
/archive/text_iarchive.hpp:80: undefined reference to `boost::archive::basic_text_iprimitivestd::istream::~basic_text_iprimitive()'
/archive/text_iarchive.hpp:80: undefined reference to `boost::archive::basic_text_iprimitivestd::istream::~basic_text_iprimitive()'
/archive/text_iarchive.hpp:80: undefined reference to `boost::archive::basic_text_iprimitivestd::istream::~basic_text_iprimitive()'
/archive/text_iarchive.hpp:80: undefined reference to `boost::archive::basic_text_iprimitivestd::istream::~basic_text_iprimitive()'
/archive/text_iarchive.hpp:80: undefined reference to `boost::archive::basic_text_iprimitivestd::istream::~basic_text_iprimitive()'
obj\Debug\main.o:
/archive/text_iarchive.hpp:80: more undefined references to `boost::archive::basic_text_iprimitivestd::istream::~basic_text_iprimitive()' follow
obj\Debug\main.o: In function `~common_oarchive':
archive/detail/common_oarchive.hpp:38: undefined reference to `boost::archive::detail::basic_oarchive::~basic_oarchive()'
/archive/detail/common_oarchive.hpp:38: undefined reference to `boost::archive::detail::basic_oarchive::~basic_oarchive()'
/archive/detail/common_oarchive.hpp:38: undefined reference to `boost::archive::detail::basic_oarchive::~basic_oarchive()'
obj\Debug\main.o: In function `~common_iarchive':
/archive/detail/common_iarchive.hpp:43: undefined reference to `boost::archive::detail::basic_iarchive::~basic_iarchive()'
/archive/detail/common_iarchive.hpp:43: undefined reference to `boost::archive::detail::basic_iarchive::~basic_iarchive()'
/archive/detail/common_iarchive.hpp:43: undefined reference to `boost::archive::detail::basic_iarchive::~basic_iarchive()'
obj\Debug\main.o:
/archive/detail/oserializer.hpp:253: undefined reference to `boost::archive::detail::basic_oarchive::save_object(void const*, boost::archive::detail::basic_oserializer const&)'
obj\Debug\main.o:
/archive/detail/iserializer.hpp:381: undefined reference to `boost::archive::detail::basic_iarchive::load_object(void*, boost::archive::detail::basic_iserializer const&)'
obj\Debug\main.o: In function `oserializer':
/archive/detail/oserializer.hpp:112: undefined reference to `boost::archive::detail::basic_oserializer::basic_oserializer(boost::serialization::extended_type_info const&)'
obj\Debug\main.o: In function `~oserializer':
/archive/detail/oserializer.hpp:133: undefined reference to `boost::archive::detail::basic_oserializer::~basic_oserializer()'
/archive/detail/oserializer.hpp:133: undefined reference to `boost::archive::detail::basic_oserializer::~basic_oserializer()'
/archive/detail/oserializer.hpp:133: undefined reference to `boost::archive::detail::basic_oserializer::~basic_oserializer()'
obj\Debug\main.o: In function `iserializer':
/archive/detail/iserializer.hpp:133: undefined reference to `boost::archive::detail::basic_iserializer::basic_iserializer(boost::serialization::extended_type_info const&)'
obj\Debug\main.o: In function `~iserializer':
/archive/detail/iserializer.hpp:158: undefined reference to `boost::archive::detail::basic_iserializer::~basic_iserializer()'
/archive/detail/iserializer.hpp:158: undefined reference to `boost::archive::detail::basic_iserializer::~basic_iserializer()'
/archive/detail/iserializer.hpp:158: undefined reference to `boost::archive::detail::basic_iserializer::~basic_iserializer()'
obj\Debug\main.o: In function `extended_type_info_typeid':
/serialization/extended_type_info_typeid.hpp:86: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::extended_type_info_typeid_0(char const*)'
/serialization/extended_type_info_typeid.hpp:88: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::type_register(std::type_info const&)'
/serialization/extended_type_info_typeid.hpp:89: undefined reference to `boost::serialization::extended_type_info::key_register() const'
/serialization/extended_type_info_typeid.hpp:89: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
obj\Debug\main.o: In function `~extended_type_info_typeid':
/serialization/extended_type_info_typeid.hpp:92: undefined reference to `boost::serialization::extended_type_info::key_unregister() const'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::type_unregister()'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
/serialization/extended_type_info_typeid.hpp:92: undefined reference to `boost::serialization::extended_type_info::key_unregister() const'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::type_unregister()'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
/serialization/extended_type_info_typeid.hpp:92: undefined reference to `boost::serialization::extended_type_info::key_unregister() const'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::type_unregister()'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
/serialization/extended_type_info_typeid.hpp:93: undefined reference to `boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()'
obj\Debug\main.o:main.cpp:(.rdata$_ZTVN5boost13serialization6detail17singleton_wrapperINS0_25extended_type_info_typeidI12gps_positionEEEE[vtable for boost::serialization::detail::singleton_wrapper
You have to build boost and link to the libboost_serialization-... library. Serialization is not a header only library. That's what Vladimir was pointing out. http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html explains how that works. Note especially that auto-linking doesn't work with MinGW. You have to specify the libraries to link against yourself. Have a nice day, Stefan On 8/7/2010 8:22 PM, Hossein Haeri wrote:
Dear Volodya,
Does
http://vladimir_prus.blogspot.com/2009/06/linking-101.html
help?
Nope. Because (using some automatic tools), I DO know that most of those member functions that the error messages in the P.S. mentions are not implemented in my respective Boost.Serialization directory. Might that be because Serialization needs some form of pre-use build? Or, am I missing something else?
TIA, --Hossein
participants (3)
-
Hossein Haeri
-
Stefan van Kessel
-
Vladimir Prus