Hi,
I tried including <boost/serialization/string.hpp> file but still getting the crash. I have tried to resolve the problem by overloading << as follows : XMLArchive & operator << (XMLArchive &xa, const struct EMPLOYEE &e) { xa << BOOST_SERIALIZATION_NVP(e.id); xa << BOOST_SERIALIZATION_NVP(e.name); return xa; } and calling it like this : xa << e; But, though I am getting the expected result, it still gives me a WARNING As follows : test.cc: In function ‘int main()’: test.cc:94: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: test.cc:72: note: candidate 1: XMLArchive& operator<<(XMLArchive&, const EMPLOYEE&) /usr/include/boost/archive/detail/interface_oarchive.hpp:63: note: candidate 2: Archive& boost::archive::detail::interface_oarchive<Archive>::operator<<(T&) [with T = EMPLOYEE, Archive = boost::archive::xml_oarchive] If I call "<<()" as : operator <<(xa, e); then it gives me no WARNING. Also, "ltrace -C " for the crashed program is as below : __libc_start_main(0x804a554, 1, 0xbf973d44, 0x804beb0, 0x804bea0 <unfinished ...> std::ios_base::Init::Init()(0x804f554, 0x8967bc, 0, 0xb7f52438, 1) = 9 __cxa_atexit(0x804a2b8, 0x804f554, 0x804bf68, 0xb7f52438, 1) = 0 __cxa_guard_acquire(0x804f558, 0x804f258, 0, 0x48bff4, 0x804beb0) = 1 __cxa_guard_acquire(0x804f560, 0x8049d93, 0x23b1f0, 0xb7f532f0, 0xb7f53a8c) = 1 boost::serialization::detail::extended_type_info_typeid_0::extended_type_info_typeid_0()(0x804f590, 0xbf973b74, 1, 1, 0) = 0xb6bf88 boost::serialization::detail::extended_type_info_typeid_0::type_register(std::type_info const&)(0x804f590, 0x804c7f4, 1, 1, 0) = 0x99d0008 __cxa_guard_release(0x804f560, 0x8049d93, 0x23b1f0, 0xb7f532f0, 0xb7f53a8c) = 0x804f560 __cxa_atexit(0x804b20c, 0x804f590, 0x804bf68, 0xb7f532f0, 0xb7f53a8c) = 0 boost::archive::detail::basic_oserializer::basic_oserializer(boost::serialization::extended_type_info const&)(0x804f584, 0x804f590, 0x804f38c, 0, 0x23b1f0) = 0x804f584 __cxa_guard_release(0x804f558, 0x804f258, 0, 0x48bff4, 0x804beb0) = 0x804f558 __cxa_atexit(0x804ae62, 0x804f584, 0x804bf68, 0x48bff4, 0x804beb0) = 0 std::basic_ofstream<char, std::char_traits<char> >::basic_ofstream(char const*, std::_Ios_Openmode)(0xbf973b1c, 0x804c0af, 48, 0x896818, 0xb7f52428) = 0xbf973ba8 boost::archive::xml_oarchive_impl<boost::archive::xml_oarchive>::xml_oarchive_impl(std::ostream&, unsigned int)(0xbf973c30, 0xbf973b1c, 0, 0x48bff4, 0) = 0 std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()(0xbf973c64, 0xbf973b1c, 0, 0x48bff4, 0) = 0xbf973c64 std::string::operator=(char const*)(0xbf973c64, 0x804c0bd, 48, 0x896818, 0xb7f52428) = 0xbf973c64 boost::archive::basic_xml_oarchive<boost::archive::xml_oarchive>::save_start(char const*)(0xbf973c30, 0x804c0c8, 0xff636d6e, 0xbf973c60, 0x804c0bd) = 0xbf973c30 boost::archive::detail::basic_oarchive::save_object(void const*, boost::archive::detail::basic_oserializer const&)(0xbf973c30, 0xbf973c60, 0x804f584, 0x1010101, 0x1010101 <unfinished ...> boost::archive::basic_xml_oarchive<boost::archive::xml_oarchive>::save_override(boost::archive::class_id_optional_type const&, int)(0xbf973c30, 0xbf973a0c, 0, 0, 0xaffd10) = 0xbf973b1c boost::archive::basic_xml_oarchive<boost::archive::xml_oarchive>::save_override(boost::archive::tracking_type const&, int)(0xbf973c30, 0xbf973a1f, 0, 0, 0xaffd10) = 0xbf973b1c boost::archive::basic_xml_oarchive<boost::archive::xml_oarchive>::save_override(boost::archive::version_type const&, int)(0xbf973c30, 0xbf973a10, 0, 0, 0xaffd10) = 0xbf973b1c __dynamic_cast(0xbf973c30, 0x804f4f0, 0x804c9ec, 0, 0xafd170) = 0 __cxa_bad_cast(0xbf973c30, 0x804f4f0, 0x804c9ec, 0, 0xafd170 <unfinished ...> __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 terminate called after throwing an instance of 'std::bad_cast' __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 1, 0x432b2b00, 0x474e5543, 0x99d2480) = 6 __gxx_personality_v0(1, 2, 0x432b2b00, 0x474e5543, 0x99d2480) = 8 __gxx_personality_v0(1, 6, 0x432b2b00, 0x474e5543, 0x99d2480) = 7 what(): std::bad_cast --- SIGABRT (Aborted) --- +++ killed by SIGABRT +++ So, does anyone know about any solution on,
* either, how to remove the WARNING
* or, how to avoid the crash?
I am using boost-1.37.0-6.fc11.i586 on FC11.
Regards, Girish --- On Fri, 2/19/10, Robert Ramey <ramey@rrsd.com> wrote:
|